aboutsummaryrefslogtreecommitdiff
path: root/docker/build-inner.sh
diff options
context:
space:
mode:
authorSulfurNitride <SulfurNitride@users.noreply.github.com>2026-03-11 12:21:39 -0500
committerSulfurNitride <SulfurNitride@users.noreply.github.com>2026-03-11 12:21:39 -0500
commitad268d496f01512f3b67afeb8d6c358c17559c82 (patch)
tree7f4d6e22968053b22ca49935353c986df147377b /docker/build-inner.sh
parent7235a616426d55502aac33de68fca68e715ce18d (diff)
Fix tracked writes false positives, stale entries, portability, and launcher self-destruct
- Remove initialScan() from mount and unmount — its heuristic ("file exists in both overwrite and a mod") caused false-positive tracking of game-generated config files. Tracking now only happens through explicit UI actions or snapshot-based detectManualMoves(). - Prune stale tracked entries on load when mod folder no longer exists on disk. - Store mod paths as relative (to JSON file parent) for instance portability; legacy absolute paths auto-migrate on next save. - Guard launcher sync against HERE==BIN_DST to prevent rm -rf self-destruct when running directly from ~/.local/share/fluorine/bin/. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Diffstat (limited to 'docker/build-inner.sh')
-rwxr-xr-xdocker/build-inner.sh24
1 files changed, 15 insertions, 9 deletions
diff --git a/docker/build-inner.sh b/docker/build-inner.sh
index ca6bac7..3ced87f 100755
--- a/docker/build-inner.sh
+++ b/docker/build-inner.sh
@@ -330,16 +330,22 @@ export FLUORINE_ORIG_QT_PLUGIN_PATH="${QT_PLUGIN_PATH:-}"
FLUORINE_DATA="${HOME}/.local/share/fluorine"
BIN_DST="${FLUORINE_DATA}/bin"
-# Use the main binary's mtime as a version fingerprint.
-CURRENT_VER="$(stat -c '%i:%Y' "${HERE}/ModOrganizer-core" 2>/dev/null || echo "unknown")"
-MARKER="${BIN_DST}/.version"
+# Guard: if we ARE already running from the installed location, skip the sync.
+# Without this, running the binary directly from BIN_DST would rm -rf itself.
+HERE_REAL="$(readlink -f "${HERE}")"
+DST_REAL="$(readlink -f "${BIN_DST}" 2>/dev/null || echo "")"
+if [ "${HERE_REAL}" != "${DST_REAL}" ]; then
+ # Use the main binary's mtime as a version fingerprint.
+ CURRENT_VER="$(stat -c '%i:%Y' "${HERE}/ModOrganizer-core" 2>/dev/null || echo "unknown")"
+ MARKER="${BIN_DST}/.version"
-if [ ! -f "${MARKER}" ] || [ "$(cat "${MARKER}" 2>/dev/null)" != "${CURRENT_VER}" ]; then
- echo "Syncing Fluorine to ${BIN_DST}..." >&2
- rm -rf "${BIN_DST}"
- mkdir -p "${BIN_DST}"
- (cd "${HERE}" && tar --exclude-vcs -cf - .) | (cd "${BIN_DST}" && tar -xf -)
- echo "${CURRENT_VER}" > "${MARKER}"
+ if [ ! -f "${MARKER}" ] || [ "$(cat "${MARKER}" 2>/dev/null)" != "${CURRENT_VER}" ]; then
+ echo "Syncing Fluorine to ${BIN_DST}..." >&2
+ rm -rf "${BIN_DST}"
+ mkdir -p "${BIN_DST}"
+ (cd "${HERE}" && tar --exclude-vcs -cf - .) | (cd "${BIN_DST}" && tar -xf -)
+ echo "${CURRENT_VER}" > "${MARKER}"
+ fi
fi
# Run from the synced location.