diff --git a/nixos/common/software/cli/scripts/btrfs-backup.sh b/nixos/common/software/cli/scripts/btrfs-backup.sh index eb53a2c6..606050f3 100644 --- a/nixos/common/software/cli/scripts/btrfs-backup.sh +++ b/nixos/common/software/cli/scripts/btrfs-backup.sh @@ -12,7 +12,7 @@ fi SNAPPER_CONFIG="$1" # Get the actual snapshot location from snapper config -SOURCE_PATH=$(snapper -c "$SNAPPER_CONFIG" get-config | grep '^SUBVOLUME' | cut -d'=' -f2 | tr -d '"'| awk {'print $3'}) +SOURCE_PATH=$(sudo snapper -c "$SNAPPER_CONFIG" get-config | grep '^SUBVOLUME' | cut -d'=' -f2 | tr -d '"'| awk {'print $3'}) if [ -z "$SOURCE_PATH" ]; then echo "ERROR: Could not determine snapshot path for config '$SNAPPER_CONFIG'" exit 1 @@ -35,7 +35,7 @@ KEEP_SNAPSHOTS=5 set -e # Verify snapper config exists -if ! snapper -c "$SNAPPER_CONFIG" list &>/dev/null; then +if ! sudo snapper -c "$SNAPPER_CONFIG" list &>/dev/null; then echo "ERROR: Snapper config '$SNAPPER_CONFIG' does not exist" exit 1 fi @@ -97,7 +97,7 @@ verify_remote LAST_TRANSFERRED=$(cat "$STATE_FILE" 2>/dev/null || echo "") # Get latest snapshot number from snapper -LATEST_SNAPSHOT=$(snapper -c "$SNAPPER_CONFIG" list | tail -n 1 | awk '{print $1}') +LATEST_SNAPSHOT=$(sudo snapper -c "$SNAPPER_CONFIG" list | tail -n 1 | awk '{print $1}') # Verify snapshots exist verify_snapshot "$LATEST_SNAPSHOT" || exit 1