Update files
This commit is contained in:
@@ -9,8 +9,11 @@ in
|
||||
boot.initrd.postDeviceCommands = lib.mkAfter ''
|
||||
mkdir /btrfs_tmp
|
||||
mount ${rootDisk} /btrfs_tmp
|
||||
|
||||
# Ensure the old_roots directory exists
|
||||
mkdir -p /btrfs_tmp/old_roots
|
||||
|
||||
if [[ -e /btrfs_tmp/root ]]; then
|
||||
mkdir -p /btrfs_tmp/old_roots
|
||||
timestamp=$(date +%Y-%m-%d_%H-%M-%S)
|
||||
mv /btrfs_tmp/root "/btrfs_tmp/old_roots/$timestamp"
|
||||
fi
|
||||
@@ -24,6 +27,8 @@ in
|
||||
}
|
||||
|
||||
for i in $(find /btrfs_tmp/old_roots/ -maxdepth 1 -mtime +7); do
|
||||
# Don't delete the old_roots directory itself
|
||||
if [[ "$i" == "/btrfs_tmp/old_roots/" ]]; then continue; fi
|
||||
delete_subvolume_recursively "$i"
|
||||
done
|
||||
|
||||
|
||||
Reference in New Issue
Block a user