From 9a77544b03f9cd7e784f7832ef03e00e3daeacac Mon Sep 17 00:00:00 2001 From: Chris Date: Sat, 20 Jun 2026 21:01:13 +0100 Subject: [PATCH] Update files --- hardware/filesystem.nix | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/hardware/filesystem.nix b/hardware/filesystem.nix index 1ab6a3a..dbb2ed4 100644 --- a/hardware/filesystem.nix +++ b/hardware/filesystem.nix @@ -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