diff --git a/app/sovran_systemsos_web/scripts/sovran-hub-backup.sh b/app/sovran_systemsos_web/scripts/sovran-hub-backup.sh index c995cc1..ec27892 100755 --- a/app/sovran_systemsos_web/scripts/sovran-hub-backup.sh +++ b/app/sovran_systemsos_web/scripts/sovran-hub-backup.sh @@ -39,9 +39,9 @@ FAILED_ALREADY=0 BACKUP_COMPLETE=0 RSYNC_WARNINGS=() -# Stable mirror path — not timestamped so later runs update the same -# destination and only transfer new or changed files. -CURRENT_DIR_NAME="Sovran_SystemsOS_Backup/current" +# Stable rsync mirror sub-path under the target drive. Not timestamped +# so later runs update the same destination and only transfer new or changed files. +BACKUP_SUBPATH="Sovran_SystemsOS_Backup/current" # ── Logging helpers ────────────────────────────────────────────── @@ -329,7 +329,7 @@ validate_target_mount "$TARGET" # ── Set up stable backup destination ──────────────────────────── # Subsequent runs update the same mirror, transferring only new or changed files. -BACKUP_DIR="${TARGET}/${CURRENT_DIR_NAME}" +BACKUP_DIR="${TARGET}/${BACKUP_SUBPATH}" mkdir -p "$BACKUP_DIR" # Write an INCOMPLETE marker immediately; replaced by BACKUP_COMPLETE only diff --git a/app/tests/test_manual_backup_workflow.py b/app/tests/test_manual_backup_workflow.py index 0687263..bd41b43 100644 --- a/app/tests/test_manual_backup_workflow.py +++ b/app/tests/test_manual_backup_workflow.py @@ -76,6 +76,8 @@ class ManualBackupWorkflowTests(unittest.TestCase): source = BACKUP_SCRIPT.read_text() self.assertIn("Sovran_SystemsOS_Backup/current", source, "backup must use a stable 'current' mirror path") + self.assertIn("BACKUP_SUBPATH", source, + "stable sub-path must be defined in BACKUP_SUBPATH variable") # Must not create new timestamped directories per run self.assertNotIn( "date '+%Y%m%d_%H%M%S'", @@ -566,8 +568,8 @@ echo "SHOULD_NOT_REACH_HERE" script = f"""#!/usr/bin/env bash set -euo pipefail TARGET="{target}" -CURRENT_DIR_NAME="Sovran_SystemsOS_Backup/current" -BACKUP_DIR="${{TARGET}}/${{CURRENT_DIR_NAME}}" +BACKUP_SUBPATH="Sovran_SystemsOS_Backup/current" +BACKUP_DIR="${{TARGET}}/${{BACKUP_SUBPATH}}" mkdir -p "$BACKUP_DIR" echo "$BACKUP_DIR" """