From 9aa6a32340cc3331fba385a791eebe36144dcb9d Mon Sep 17 00:00:00 2001 From: SulfurNitride Date: Sun, 12 Apr 2026 14:41:43 -0500 Subject: Fix launcher sync triggering on every fresh tarball extraction MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Version fingerprint was stat -c '%i:%Y' which includes the inode number. Re-extracting the same tarball produces new inodes, so the marker never matched and the 237MB copy to ~/.local/share/fluorine/bin/ ran on every launch — painful cross-drive (tarball on one disk, home on another). Switch to '%s:%Y' (size + mtime). Survives re-extraction, still detects real updates. Also stage into bin.new/ and rename instead of rm -rf'ing bin/ before the tar pipe. If the user Ctrl+C's mid-sync (or the copy fails), the existing install stays intact instead of being left empty. Co-Authored-By: Claude Opus 4.6 (1M context) --- docker/build-inner.sh | 17 ++++++++++++----- 1 file changed, 12 insertions(+), 5 deletions(-) (limited to 'docker') diff --git a/docker/build-inner.sh b/docker/build-inner.sh index a5c8c0b..a53f79c 100755 --- a/docker/build-inner.sh +++ b/docker/build-inner.sh @@ -363,16 +363,23 @@ BIN_DST="${FLUORINE_DATA}/bin" 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")" + # Fingerprint from size+mtime (not inode) so re-extracting the same tarball + # onto a different filesystem doesn't trigger a spurious full resync. + CURRENT_VER="$(stat -c '%s:%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 + echo "Syncing Fluorine to ${BIN_DST} (this may take a minute on first launch)..." >&2 + # Stage into bin.new/ then rename. Protects the existing install if the + # user Ctrl+C's mid-sync or the copy fails partway. + STAGE="${BIN_DST}.new" + rm -rf "${STAGE}" + mkdir -p "${STAGE}" + (cd "${HERE}" && tar --exclude-vcs -cf - .) | (cd "${STAGE}" && tar -xf -) rm -rf "${BIN_DST}" - mkdir -p "${BIN_DST}" - (cd "${HERE}" && tar --exclude-vcs -cf - .) | (cd "${BIN_DST}" && tar -xf -) + mv "${STAGE}" "${BIN_DST}" echo "${CURRENT_VER}" > "${MARKER}" + echo "Sync complete." >&2 fi fi -- cgit v1.3.1