diff --git a/.gitignore b/.gitignore index 22652d2..cdb440f 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,6 @@ # build output /dist/ + +# local, machine-specific +/deploy.conf +/DEPLOY-NOTES.md diff --git a/mc-refresh-restart.sh b/mc-refresh-restart.sh index bd74c4b..7b810fb 100755 --- a/mc-refresh-restart.sh +++ b/mc-refresh-restart.sh @@ -14,13 +14,27 @@ set -euo pipefail +# If deploy.conf sits next to this script, every path and URL below is derived +# from it — no second place to keep in sync. The CONFIG block is the fallback. +_HERE="$(cd -- "$(dirname -- "${BASH_SOURCE[0]}")" && pwd)" +if [ -f "${_HERE}/deploy.conf" ]; then + # shellcheck source=/dev/null + . "${_HERE}/deploy.conf" + _SLUG="$(printf '%s' "${PACK_NAME}" | tr '[:upper:] ' '[:lower:]-' | tr -cd 'a-z0-9-')" + _SITE="${MIRROR_URL%/*}" +fi + ### CONFIG ############################################### -SHARE="/minecraft" # ZFS dataset mountpoint -PACK_DIR="${SHARE}/packs/mypack" # packwiz project root (has pack.toml) +SHARE="${SHARE:-/minecraft}" # ZFS dataset mountpoint +PACK_DIR="${_SLUG:+${SHARE}/packs/${_SLUG}}" # packwiz project root (has pack.toml) +PACK_DIR="${PACK_DIR:-${SHARE}/packs/mypack}" MODS_DIR="${SHARE}/mods" # server+client mods, loaded by the server CLIENT_MODS_DIR="${SHARE}/client-mods" # client-only mods, never loaded server-side -BASE_URL="https://games.abdelbaki.eu/mods" # mirror base URL, no trailing slash -PACK_URL="https://games.abdelbaki.eu/packs/mypack" # where PACK_DIR is served; "" to skip the check +BASE_URL="${MIRROR_URL:-https://games.abdelbaki.eu/abdelpakDelta/mods}" # mirror for MODS_DIR +CLIENT_URL="${_SITE:+${_SITE}/client-mods}" # mirror for CLIENT_MODS_DIR +CLIENT_URL="${CLIENT_URL:-https://games.abdelbaki.eu/abdelpakDelta/client-mods}" +PACK_URL="${_SITE:+${_SITE}/packs/${_SLUG}}" # where PACK_DIR is served +PACK_URL="${PACK_URL:-https://games.abdelbaki.eu/abdelpakDelta/packs/abdelpakdelta}" SERVICE_NAME="minecraft.service" START_TIMEOUT=60 # seconds to wait for the service to report active KEEP_SNAPSHOTS=8 # how many snapshots to retain