test: impermanence

This commit is contained in:
Nick 2025-11-05 01:06:47 -06:00
parent c19e729f94
commit 1c2277ef9b

View file

@ -36,13 +36,13 @@ in
}; };
}; };
boot.initrd.postResumeCommands = lib.mkAfter '' postResumeCommands = lib.mkAfter ''
mkdir -p /btrfs_tmp mkdir /btrfs_tmp
mount -o subvol=/ /dev/disk/by-label/root /btrfs_tmp mount -o subvolid=5 /dev/sdb2 /btrfs_tmp
if [[ -e /btrfs_tmp/root ]]; then if [[ -e /btrfs_tmp/root ]]; then
mkdir -p /btrfs_tmp/old_roots mkdir -p /btrfs_tmp/old_roots
timestamp=$(date --date="@$(stat -c %Y /btrfs_tmp/root)" "+%Y-%m-%d_%H:%M:%S") timestamp=$(date --date="@$(stat -c %Y /btrfs_tmp/root)" "+%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
@ -54,7 +54,7 @@ in
btrfs subvolume delete "$1" btrfs subvolume delete "$1"
} }
for i in $(find /btrfs_tmp/old_roots/ -maxdepth 1 -mtime +30 2>/dev/null); do for i in $(find /btrfs_tmp/old_roots/ -maxdepth 1 -mtime +30); do
delete_subvolume_recursively "$i" delete_subvolume_recursively "$i"
done done