mirror of
https://github.com/Misterio77/Foundry.git
synced 2026-09-26 17:10:39 -04:00
hosts: don't wipe btrfs if there's a dontwipe file
This commit is contained in:
@@ -4,14 +4,18 @@
|
||||
mkdir -p /mnt
|
||||
mount -o subvol=/ /dev/disk/by-label/${hostname} /mnt
|
||||
|
||||
echo "Cleaning subvolume"
|
||||
btrfs subvolume list -o /mnt/root | cut -f9 -d ' ' |
|
||||
while read subvolume; do
|
||||
btrfs subvolume delete "/mnt/$subvolume"
|
||||
done && btrfs subvolume delete /mnt/root
|
||||
if [ -e "/mnt/root/dontwipe" ]; then
|
||||
echo "Not wiping root"
|
||||
else
|
||||
echo "Cleaning subvolume"
|
||||
btrfs subvolume list -o /mnt/root | cut -f9 -d ' ' |
|
||||
while read subvolume; do
|
||||
btrfs subvolume delete "/mnt/$subvolume"
|
||||
done && btrfs subvolume delete /mnt/root
|
||||
|
||||
echo "Restoring blank subvolume"
|
||||
btrfs subvolume snapshot /mnt/root-blank /mnt/root
|
||||
echo "Restoring blank subvolume"
|
||||
btrfs subvolume snapshot /mnt/root-blank /mnt/root
|
||||
fi
|
||||
|
||||
umount /mnt
|
||||
'';
|
||||
|
||||
Reference in New Issue
Block a user