mirror of
https://gitlab.com/upRootNutrition/dotfiles.git
synced 2025-12-07 21:42:16 -06:00
test: impermanence
This commit is contained in:
parent
ee6b51b2de
commit
c19e729f94
1 changed files with 6 additions and 6 deletions
|
|
@ -40,10 +40,10 @@ in
|
||||||
mkdir -p /btrfs_tmp
|
mkdir -p /btrfs_tmp
|
||||||
mount -o subvol=/ /dev/disk/by-label/root /btrfs_tmp
|
mount -o subvol=/ /dev/disk/by-label/root /btrfs_tmp
|
||||||
|
|
||||||
if [[ -e /btrfs_tmp/@ ]]; 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/@)" "+%Y-%m-%d_%H:%M:%S")
|
timestamp=$(date --date="@$(stat -c %Y /btrfs_tmp/root)" "+%Y-%m-%d_%H:%M:%S")
|
||||||
mv /btrfs_tmp/@ "/btrfs_tmp/@old_roots/$timestamp"
|
mv /btrfs_tmp/root "/btrfs_tmp/old_roots/$timestamp"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
delete_subvolume_recursively() {
|
delete_subvolume_recursively() {
|
||||||
|
|
@ -54,11 +54,11 @@ 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 2>/dev/null); do
|
||||||
delete_subvolume_recursively "$i"
|
delete_subvolume_recursively "$i"
|
||||||
done
|
done
|
||||||
|
|
||||||
btrfs subvolume create /btrfs_tmp/@
|
btrfs subvolume create /btrfs_tmp/root
|
||||||
umount /btrfs_tmp
|
umount /btrfs_tmp
|
||||||
'';
|
'';
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue