From 894f1f18be1ce0e1c03230df23154be6778488dd Mon Sep 17 00:00:00 2001 From: Craig Jennings Date: Thu, 29 Jan 2026 12:29:37 -0600 Subject: Add test support and fix command alias usage - Make INSTALLHOME, SCRIPTLOC, LOGFILE overridable via env vars - Add RSYNCSHOT_SKIP_MOUNT_CHECK for testing without mount points - Use CP, MV, RM variables in run_cmd to avoid shell alias issues --- rsyncshot | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/rsyncshot b/rsyncshot index ead2e11..f360e6f 100755 --- a/rsyncshot +++ b/rsyncshot @@ -942,7 +942,7 @@ log "Rotating snapshots..." # --- Delete oldest snapshot if it exceeds retention count --- if run_cmd "[ -d '$BASE_PATH/$TYPE.$MAX' ]"; then log "Deleting oldest snapshot: $TYPE.$MAX" - run_cmd "rm -rf '$BASE_PATH/$TYPE.$MAX'" + run_cmd "$RM -rf '$BASE_PATH/$TYPE.$MAX'" fi # --- Rotate existing snapshots (newest to oldest to avoid overwriting) --- @@ -950,7 +950,7 @@ for (( start=$((MAX)); start>=0; start-- )); do end=$((start+1)) if run_cmd "[ -d '$BASE_PATH/$TYPE.$start' ]"; then log "Rotating: $TYPE.$start -> $TYPE.$end" - run_cmd "mv '$BASE_PATH/$TYPE.$start' '$BASE_PATH/$TYPE.$end'" + run_cmd "$MV '$BASE_PATH/$TYPE.$start' '$BASE_PATH/$TYPE.$end'" fi done @@ -962,7 +962,7 @@ run_cmd "touch '$BASE_PATH/latest'" # This is instant and uses no additional disk space for unchanged files. # Only files that differ between snapshots consume extra space. log "Creating new snapshot: $TYPE.0" -run_cmd "cp -al '$BASE_PATH/latest' '$BASE_PATH/$TYPE.0'" +run_cmd "$CP -al '$BASE_PATH/latest' '$BASE_PATH/$TYPE.0'" # --- Make snapshot read-only to prevent accidental modification --- run_cmd "chmod -w '$BASE_PATH/$TYPE.0'" -- cgit v1.2.3