From b25724a61a442cef121eba3c216c96b588e4b943 Mon Sep 17 00:00:00 2001 From: Claude Date: Sat, 15 Aug 2026 03:57:58 +0000 Subject: [PATCH] Suggest a /kopia-data subdir of the DR-spare path for the SFTP mirror The additional-mirror "Remote path for the repo" prompt always suggested a generic ~/backups/kopia-mirror default, unrelated to wherever the operator already pointed the DR-spare sync. Requested directly: default to that same location instead, in its own /kopia-data subdirectory so Kopia's repository files don't end up visually mixed in with the two plain config files (backup.conf, README.md) the DR-spare sync writes straight into DR_SYNC_PATH itself. Falls back to the original generic default when DR_SYNC_PATH isn't set (no DR-spare configured yet). Verified the path computation handles a DR_SYNC_PATH with or without a trailing slash correctly (no double slash), and the unset case still falls back as before. --- services/backup.sh | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/services/backup.sh b/services/backup.sh index d742bab..d43c60f 100644 --- a/services/backup.sh +++ b/services/backup.sh @@ -966,9 +966,18 @@ install_backup() { # same Port line correctly. _SFTP_PORT="${_SFTP_PORT:-22}" log_info " Using ${_SFTP_USER}@${_SFTP_HOSTNAME}:${_SFTP_PORT} for this mirror (resolved via ~/.ssh/config)." + # Suggest a subdirectory of the DR-spare's own path (if one is + # configured) rather than an unrelated default — reusing the + # same spare location the operator already picked, but in its + # own /kopia-data subdirectory so the actual repository data + # (Kopia's own blob-store files) doesn't end up visually mixed + # in with the two plain config files the DR-spare sync writes + # directly into DR_SYNC_PATH itself. + local _SFTP_PATH_DEFAULT="~/backups/kopia-mirror" + [ -n "${DR_SYNC_PATH:-}" ] && _SFTP_PATH_DEFAULT="${DR_SYNC_PATH%/}/kopia-data" local _SFTP_PATH="" _MIRROR_NAME="" - prompt_text " Remote path for the repo:" "~/backups/kopia-mirror" _SFTP_PATH - _SFTP_PATH="${_SFTP_PATH:-~/backups/kopia-mirror}" + prompt_text " Remote path for the repo:" "$_SFTP_PATH_DEFAULT" _SFTP_PATH + _SFTP_PATH="${_SFTP_PATH:-$_SFTP_PATH_DEFAULT}" prompt_text " Short name for this mirror (letters/numbers/underscores):" "spare" _MIRROR_NAME _MIRROR_NAME="${_MIRROR_NAME:-spare}" _MIRROR_NAME="${_MIRROR_NAME//[^a-zA-Z0-9_]/_}"