diff options
| author | Craig Jennings <c@cjennings.net> | 2026-01-29 12:29:37 -0600 |
|---|---|---|
| committer | Craig Jennings <c@cjennings.net> | 2026-01-29 12:29:37 -0600 |
| commit | 894f1f18be1ce0e1c03230df23154be6778488dd (patch) | |
| tree | 76ee1bee6c1bda46adc943f664636fefcad25ebb | |
| parent | 051dbede5f8a502ad9896648bebf9df38ecc49bb (diff) | |
| download | rsyncshot-894f1f18be1ce0e1c03230df23154be6778488dd.tar.gz rsyncshot-894f1f18be1ce0e1c03230df23154be6778488dd.zip | |
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
| -rwxr-xr-x | rsyncshot | 6 |
1 files changed, 3 insertions, 3 deletions
@@ -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'" |
