mirror of
https://gitlab.com/upRootNutrition/dotfiles.git
synced 2025-12-06 21:17:14 -06:00
test: impermanence
This commit is contained in:
parent
f5d5950e0a
commit
b1067ff181
1 changed files with 6 additions and 6 deletions
|
|
@ -12,7 +12,7 @@ in
|
|||
"/" = {
|
||||
device = "/dev/disk/by-uuid/00d712c2-5883-4409-afd8-514886f4e824";
|
||||
fsType = "btrfs";
|
||||
options = [ "subvol=@" ];
|
||||
options = [ "subvol=root" ];
|
||||
};
|
||||
|
||||
"/nix" = {
|
||||
|
|
@ -42,12 +42,12 @@ in
|
|||
|
||||
boot.initrd.postResumeCommands = lib.mkAfter ''
|
||||
mkdir /btrfs_tmp
|
||||
mount -o subvolid=5 /dev/sda2 /btrfs_tmp
|
||||
mount -o subvolid=5 /dev/sdb2 /btrfs_tmp
|
||||
|
||||
if [[ -e /btrfs_tmp/@ ]]; then
|
||||
if [[ -e /btrfs_tmp/root ]]; then
|
||||
mkdir -p /btrfs_tmp/old_roots
|
||||
timestamp=$(date --date="@$(stat -c %Y /btrfs_tmp/@)" "+%Y-%m-%-d_%H:%M:%S")
|
||||
mv /btrfs_tmp/@ "/btrfs_tmp/old_roots/$timestamp"
|
||||
timestamp=$(date --date="@$(stat -c %Y /btrfs_tmp/root)" "+%Y-%m-%-d_%H:%M:%S")
|
||||
mv /btrfs_tmp/root "/btrfs_tmp/old_roots/$timestamp"
|
||||
fi
|
||||
|
||||
delete_subvolume_recursively() {
|
||||
|
|
@ -62,7 +62,7 @@ in
|
|||
delete_subvolume_recursively "$i"
|
||||
done
|
||||
|
||||
btrfs subvolume create /btrfs_tmp/@
|
||||
btrfs subvolume create /btrfs_tmp/root
|
||||
umount /btrfs_tmp
|
||||
'';
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue