Derive the pull target from the install location, so master.conf is safe to share between hosts

This commit is contained in:
Gmer4Lfe
2026-08-16 13:54:05 -04:00
parent 98fab394a1
commit 3c24550b19
2 changed files with 27 additions and 7 deletions
+10 -1
View File
@@ -345,7 +345,16 @@
GITEA_CONTAINER="Gitea" GITEA_CONTAINER="Gitea"
GITEA_REPO_PATH="" # e.g. YourUser/Varaverk.git GITEA_REPO_PATH="" # e.g. YourUser/Varaverk.git
GITEA_DOMAIN="" # e.g. git.yourdomain.com — requires NPM + DNS GITEA_DOMAIN="" # e.g. git.yourdomain.com — requires NPM + DNS
TARGET_DIR="/mnt/user/appdata/Varaverk" # Derived, never a literal. This is the directory git_pull_execute.sh pulls into, and it is the
# one host-specific path that used to live in master.conf as a fixed string — which made the
# shared conf unshareable: pushing it to a partner that had migrated its install repointed that
# partner's pull target at the old location, and the next pull built a second copy there while
# the live install ran somewhere else.
#
# SCRIPTS_DIR is exported by load_config.sh from its own location before this file is sourced, so
# this resolves to wherever the install actually is, on every node, in either storage mode, with
# nothing to keep in step. DATA_DIR and STATE_DIR below already worked this way.
TARGET_DIR="${SCRIPTS_DIR}"
GITEA_SSH_KEY="/root/.ssh/unraid_gitea" GITEA_SSH_KEY="/root/.ssh/unraid_gitea"
SSH_PORT=221 # Gitea SSH port (default 22, Gitea often uses 221/222) SSH_PORT=221 # Gitea SSH port (default 22, Gitea often uses 221/222)
GITEA_HTTP_PORT=3000 # Gitea web/API port — used by gitea_ssh_setup.sh GITEA_HTTP_PORT=3000 # Gitea web/API port — used by gitea_ssh_setup.sh
+17 -6
View File
@@ -281,12 +281,23 @@ echo "━━━ $ICON_GEAR Step 4: Update master.conf paths ━━━"
NEW_MASTER="$DST/Configurations/master.conf" NEW_MASTER="$DST/Configurations/master.conf"
if [[ "$DRY_RUN" == false ]]; then if [[ "$DRY_RUN" == false ]]; then
if [[ -f "$NEW_MASTER" ]]; then if [[ -f "$NEW_MASTER" ]]; then
sed -i "s|^\(\s*TARGET_DIR\s*=\s*\)\"[^\"]*\"|\1\"$DST\"|" "$NEW_MASTER" # Only rewrite a path that is a literal. These three are derived from SCRIPTS_DIR in
sed -i "s|^\(\s*DATA_DIR\s*=\s*\)\"[^\"]*\"|\1\"$DST/data\"|" "$NEW_MASTER" # current confs, which load_config.sh exports from its own location — so after the move
sed -i "s|^\(\s*STATE_DIR\s*=\s*\)\"[^\"]*\"|\1\"${DST}/data/state\"|" "$NEW_MASTER" # they already point at the new install and hardcoding them here would turn a
echo " TARGET_DIR → $DST" # self-correcting value back into one that has to be maintained. Older confs still carry
echo " DATA_DIR → $DST/data ✅" # literals, so the substitution stays for them.
echo " STATE_DIR → $DST/data/state ✅" _mig_path() { # $1=key $2=new value
if grep -qE "^\s*$1\s*=\s*\"[^\"]*\\\$\{?(SCRIPTS_DIR|DATA_DIR)" "$NEW_MASTER"; then
echo " $1 — already derived, left alone ✅"
else
sed -i "s|^\(\s*$1\s*=\s*\)\"[^\"]*\"|\1\"$2\"|" "$NEW_MASTER"
echo " $1$2"
fi
}
_mig_path TARGET_DIR "$DST"
_mig_path DATA_DIR "$DST/data"
_mig_path STATE_DIR "$DST/data/state"
unset -f _mig_path
else else
error "master.conf not found at $NEW_MASTER" error "master.conf not found at $NEW_MASTER"
exit 1 exit 1