Update btrfs backups

This commit is contained in:
albert 2024-12-16 01:51:21 +01:00
parent 954b15ad8e
commit 6ab45ff490
Signed by: albert
GPG key ID: 3895DD267CA11BA9

View file

@ -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