Update files
This commit is contained in:
+37
-37
@@ -8,43 +8,43 @@ in
|
|||||||
{
|
{
|
||||||
boot.initrd.supportedFilesystems = [ "btrfs" ];
|
boot.initrd.supportedFilesystems = [ "btrfs" ];
|
||||||
|
|
||||||
# boot.initrd.systemd.services.rollback-root = {
|
boot.initrd.systemd.services.rollback-root = {
|
||||||
# description = "Rollback btrfs root subvolume";
|
description = "Rollback btrfs root subvolume";
|
||||||
# wantedBy = [ "initrd.target" ];
|
wantedBy = [ "initrd.target" ];
|
||||||
# after = [ "systemd-cryptsetup@.service" ];
|
after = [ "systemd-cryptsetup@.service" ];
|
||||||
# before = [ "sysroot.mount" ];
|
before = [ "sysroot.mount" ];
|
||||||
# unitConfig.DefaultDependencies = "no";
|
unitConfig.DefaultDependencies = "no";
|
||||||
# serviceConfig.Type = "oneshot";
|
serviceConfig.Type = "oneshot";
|
||||||
# script = ''
|
script = ''
|
||||||
# mkdir -p /btrfs_tmp
|
mkdir -p /btrfs_tmp
|
||||||
# mount ${rootDisk} /btrfs_tmp
|
mount ${rootDisk} /btrfs_tmp
|
||||||
#
|
|
||||||
# # Ensure the old_roots directory exists
|
# Ensure the old_roots directory exists
|
||||||
# mkdir -p /btrfs_tmp/old_roots
|
mkdir -p /btrfs_tmp/old_roots
|
||||||
#
|
|
||||||
# if [[ -e /btrfs_tmp/root ]]; then
|
if [[ -e /btrfs_tmp/root ]]; then
|
||||||
# timestamp=$(date +%Y-%m-%d_%H-%M-%S)
|
timestamp=$(date +%Y-%m-%d_%H-%M-%S)
|
||||||
# mv /btrfs_tmp/root "/btrfs_tmp/old_roots/$timestamp"
|
mv /btrfs_tmp/root "/btrfs_tmp/old_roots/$timestamp"
|
||||||
# fi
|
fi
|
||||||
#
|
|
||||||
# delete_subvolume_recursively() {
|
delete_subvolume_recursively() {
|
||||||
# IFS=$'\n'
|
IFS=$'\n'
|
||||||
# for i in $(btrfs subvolume list -o "$1" | cut -f 9 -d ' '); do
|
for i in $(btrfs subvolume list -o "$1" | cut -f 9 -d ' '); do
|
||||||
# delete_subvolume_recursively "/btrfs_tmp/$i"
|
delete_subvolume_recursively "/btrfs_tmp/$i"
|
||||||
# done
|
done
|
||||||
# btrfs subvolume delete "$1"
|
btrfs subvolume delete "$1"
|
||||||
# }
|
}
|
||||||
#
|
|
||||||
# for i in $(find /btrfs_tmp/old_roots/ -maxdepth 1 -mtime +7); do
|
for i in $(find /btrfs_tmp/old_roots/ -maxdepth 1 -mtime +7); do
|
||||||
# # Don't delete the old_roots directory itself
|
# Don't delete the old_roots directory itself
|
||||||
# if [[ "$i" == "/btrfs_tmp/old_roots/" ]]; then continue; fi
|
if [[ "$i" == "/btrfs_tmp/old_roots/" ]]; then continue; fi
|
||||||
# delete_subvolume_recursively "$i"
|
delete_subvolume_recursively "$i"
|
||||||
# done
|
done
|
||||||
#
|
|
||||||
# btrfs subvolume create /btrfs_tmp/root
|
btrfs subvolume create /btrfs_tmp/root
|
||||||
# umount /btrfs_tmp
|
umount /btrfs_tmp
|
||||||
# '';
|
'';
|
||||||
# };
|
};
|
||||||
|
|
||||||
# fileSystems."/" = {
|
# fileSystems."/" = {
|
||||||
# device = rootDisk;
|
# device = rootDisk;
|
||||||
|
|||||||
Reference in New Issue
Block a user