diff --git a/Deployment/master.conf.template b/Deployment/master.conf.template index 2f9f305..c32767b 100644 --- a/Deployment/master.conf.template +++ b/Deployment/master.conf.template @@ -345,7 +345,16 @@ GITEA_CONTAINER="Gitea" GITEA_REPO_PATH="" # e.g. YourUser/Varaverk.git 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" 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 diff --git a/Plugin/unraid/Tools/storage_migrate.sh b/Plugin/unraid/Tools/storage_migrate.sh index 8e783be..03a0cc4 100755 --- a/Plugin/unraid/Tools/storage_migrate.sh +++ b/Plugin/unraid/Tools/storage_migrate.sh @@ -281,12 +281,23 @@ echo "━━━ $ICON_GEAR Step 4: Update master.conf paths ━━━" NEW_MASTER="$DST/Configurations/master.conf" if [[ "$DRY_RUN" == false ]]; then if [[ -f "$NEW_MASTER" ]]; then - sed -i "s|^\(\s*TARGET_DIR\s*=\s*\)\"[^\"]*\"|\1\"$DST\"|" "$NEW_MASTER" - sed -i "s|^\(\s*DATA_DIR\s*=\s*\)\"[^\"]*\"|\1\"$DST/data\"|" "$NEW_MASTER" - sed -i "s|^\(\s*STATE_DIR\s*=\s*\)\"[^\"]*\"|\1\"${DST}/data/state\"|" "$NEW_MASTER" - echo " TARGET_DIR → $DST ✅" - echo " DATA_DIR → $DST/data ✅" - echo " STATE_DIR → $DST/data/state ✅" + # Only rewrite a path that is a literal. These three are derived from SCRIPTS_DIR in + # current confs, which load_config.sh exports from its own location — so after the move + # they already point at the new install and hardcoding them here would turn a + # self-correcting value back into one that has to be maintained. Older confs still carry + # literals, so the substitution stays for them. + _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 error "master.conf not found at $NEW_MASTER" exit 1