Update files
This commit is contained in:
@@ -9,8 +9,11 @@ in
|
|||||||
boot.initrd.postDeviceCommands = lib.mkAfter ''
|
boot.initrd.postDeviceCommands = lib.mkAfter ''
|
||||||
mkdir /btrfs_tmp
|
mkdir /btrfs_tmp
|
||||||
mount ${rootDisk} /btrfs_tmp
|
mount ${rootDisk} /btrfs_tmp
|
||||||
if [[ -e /btrfs_tmp/root ]]; then
|
|
||||||
|
# Ensure the old_roots directory exists
|
||||||
mkdir -p /btrfs_tmp/old_roots
|
mkdir -p /btrfs_tmp/old_roots
|
||||||
|
|
||||||
|
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
|
||||||
@@ -24,6 +27,8 @@ in
|
|||||||
}
|
}
|
||||||
|
|
||||||
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
|
||||||
|
if [[ "$i" == "/btrfs_tmp/old_roots/" ]]; then continue; fi
|
||||||
delete_subvolume_recursively "$i"
|
delete_subvolume_recursively "$i"
|
||||||
done
|
done
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user