aboutsummaryrefslogtreecommitdiffstats
path: root/arch-system/backup-sudo
diff options
context:
space:
mode:
authorTharre <tharre3@gmail.com>2022-01-07 21:35:28 +0100
committerTharre <tharre3@gmail.com>2023-04-25 05:33:37 +0200
commit051d76ba0e5408cae656d30079816952536cee9b (patch)
tree680799952307854a89aec5bc4d0e5c2daaf2d221 /arch-system/backup-sudo
parent59744df0d95e0a51572bfafee03de5979d810f6c (diff)
downloadpkgbuilds-051d76ba0e5408cae656d30079816952536cee9b.tar.gz
pkgbuilds-051d76ba0e5408cae656d30079816952536cee9b.tar.xz
pkgbuilds-051d76ba0e5408cae656d30079816952536cee9b.zip
arch-system: backup system updates
Diffstat (limited to 'arch-system/backup-sudo')
-rwxr-xr-xarch-system/backup-sudo11
1 files changed, 8 insertions, 3 deletions
diff --git a/arch-system/backup-sudo b/arch-system/backup-sudo
index 1091451..90590e0 100755
--- a/arch-system/backup-sudo
+++ b/arch-system/backup-sudo
@@ -12,8 +12,13 @@ validate_path() {
case "$1" in
snapshot)
validate_path "$2"
- touch /home
- btrfs subvolume snapshot -r -- /home "$2"
+ # small race, but shouldn't matter
+ if ! btrfs subvolume show "$3" > /dev/null 2>&1; then
+ echo "Not a btrfs subvolume." >&2
+ exit 3
+ fi
+ touch -c -- "$3"
+ btrfs subvolume snapshot -r -- "$3" "$2"
;;
delete_snapshot)
validate_path "$2"
@@ -26,7 +31,7 @@ case "$1" in
;;
cleanup)
umount /backup 2> /dev/null || true
- rm -rf /backup
+ rm -df /backup
;;
*)
echo "No command specified." >&2