1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
|
--- fluorine-manager 2026-10-03 01:33:33.000000000 +0200
+++ fluorine-manager 2026-10-03 14:13:24.919000000 +0200
@@ -32,139 +32,7 @@
*) FLUORINE_DATA_HOME="${HOME}/.local/share" ;;
esac
FLUORINE_DATA="${FLUORINE_DATA_HOME}/fluorine"
-BIN_DST="${FLUORINE_DATA}/bin"
-
-# 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
- # Manifest lists top-level entries that belong to Fluorine. Without it we
- # can't distinguish our files from whatever else the user parked next to
- # the launcher (e.g. extracted into ~/Downloads alongside their mods).
- MANIFEST="${HERE}/fluorine-manifest.txt"
- if [ ! -f "${MANIFEST}" ] || [ ! -f "${HERE}/ModOrganizer-core" ]; then
- echo "ERROR: Fluorine launcher can't find its bundle files in ${HERE}." >&2
- echo "Extract the release archive into its own directory and run the" >&2
- echo "launcher from there — not from a folder containing other files." >&2
- exit 1
- fi
-
- # New bundles carry a content-derived identity covering every shipped
- # regular file. Hashing this tiny identity file keeps launches cheap while
- # still noticing DLL/helper/plugin-only updates. Retain the old core
- # size+mtime identity for bundles created before this file existed.
- BUNDLE_VERSION="${HERE}/fluorine-bundle-version.txt"
- if [ -f "${BUNDLE_VERSION}" ]; then
- CURRENT_VER="bundle:$(sha256sum "${BUNDLE_VERSION}" | cut -d' ' -f1)"
- else
- CURRENT_VER="core:$(stat -c '%s:%Y' "${HERE}/ModOrganizer-core" 2>/dev/null || echo "unknown")"
- fi
- MARKER="${BIN_DST}/.version"
-
- if [ ! -f "${MARKER}" ] || [ "$(cat "${MARKER}" 2>/dev/null)" != "${CURRENT_VER}" ]; then
- if [ -d "${BIN_DST}" ]; then
- echo "Updating Fluorine in ${BIN_DST}..." >&2
- else
- echo "Installing Fluorine to ${BIN_DST} (this may take a minute on first launch)..." >&2
- fi
- mkdir -p "${BIN_DST}"
-
- # Overlay update — preserves anything the user dropped into bin/
- # (custom plugins under plugins/, a portable instance with
- # ModOrganizer.ini, downloaded mods, etc.). The manifest is our
- # authoritative list of "ours"; everything else is left alone.
- #
- # Step 1: orphan removal. Top-level entries we shipped before but no
- # longer ship get removed. Top-level granularity is enough — when the
- # entry is still in both manifests (e.g. "plugins"), we don't touch
- # the directory itself, only overwrite our own files inside.
- OLD_MANIFEST="${BIN_DST}/fluorine-manifest.txt"
- if [ -f "${OLD_MANIFEST}" ]; then
- # comm -23 = lines unique to the OLD manifest. sort -u for comm.
- while IFS= read -r entry; do
- [ -z "${entry}" ] && continue
- # Refuse anything that could escape BIN_DST.
- case "${entry}" in /*|*..*|.|..) continue ;; esac
- rm -rf "${BIN_DST:?}/${entry}"
- done < <(comm -23 \
- <(sort -u "${OLD_MANIFEST}") \
- <(sort -u "${MANIFEST}"))
- fi
-
- # Step 2: overlay copy. tar piped to tar streams the manifested entries
- # from HERE into BIN_DST. Existing directories stay; existing files we
- # ship get overwritten with the new version; user-added files inside
- # our directories (e.g. plugins/MyCustomPlugin.so) are preserved.
- if ! tar -C "${HERE}" -cf - --files-from="${MANIFEST}" 2>/dev/null \
- | tar -C "${BIN_DST}" --no-same-owner -xf - ; then
- echo "ERROR: Fluorine sync failed mid-copy. The install may be in a broken state." >&2
- echo "Re-extract the release archive and run the launcher again." >&2
- exit 1
- fi
-
- # Refresh the manifest at the destination so the next update has it.
- cp -af "${MANIFEST}" "${BIN_DST}/fluorine-manifest.txt"
- echo "${CURRENT_VER}" > "${MARKER}"
- echo "Sync complete." >&2
-
- # Clean up the in-app updater's staging directory once the new bundle
- # is live. Untouched if the user didn't go through the in-app updater.
- STAGING_DIR="${FLUORINE_DATA}/update-staging"
- [ -d "${STAGING_DIR}" ] && rm -rf "${STAGING_DIR}" 2>/dev/null || true
- fi
-fi
-
-# Overlay updates preserve files within lib/, including runtimes retired from
-# the bundle. Remove these known legacy copies even when launching directly
-# from the installed directory or when the bundle version has not changed.
-# GBM must match the host's Mesa/DRI drivers; TLS uses the host OpenSSL runtime.
-# Fontconfig must also match the host configuration it parses.
-rm -f "${BIN_DST}"/lib/libgbm.so* \
- "${BIN_DST}"/lib/libssl.so* "${BIN_DST}"/lib/libcrypto.so* \
- "${BIN_DST}"/lib/libfontconfig.so* 2>/dev/null || true
-# Retire partial NSS/NSPR bundles too, including copies from older installers.
-rm -f "${BIN_DST}"/lib/lib{nss3,nssutil3,smime3,ssl3,nspr4,plc4,plds4,softokn3,freebl3,freeblpriv3,nssckbi,nssdbm3}.so* \
- 2>/dev/null || true
-# SteamEnv now preserves Proton's environment without an LD_PRELOAD interposer.
-rm -f "${BIN_DST}/locale/x86_64/libfluorine_locale.so" \
- "${BIN_DST}/locale/i386/libfluorine_locale.so" 2>/dev/null || true
-
-# ── Install icon + desktop file for Wayland taskbar/decoration ──
-ICON_SRC="${BIN_DST}/icons/com.fluorine.manager.png"
-ICON_DST="${FLUORINE_DATA_HOME}/icons/hicolor/256x256/apps/com.fluorine.manager.png"
-DESKTOP_SRC="${BIN_DST}/icons/com.fluorine.manager.desktop"
-DESKTOP_DST="${FLUORINE_DATA_HOME}/applications/com.fluorine.manager.desktop"
-if [ -f "${ICON_SRC}" ]; then
- mkdir -p "$(dirname "${ICON_DST}")"
- ICON_TMP="${ICON_DST}.tmp.$$"
- if cp -f "${ICON_SRC}" "${ICON_TMP}"; then
- mv -f "${ICON_TMP}" "${ICON_DST}"
- else
- rm -f "${ICON_TMP}"
- fi
-fi
-if [ -f "${DESKTOP_SRC}" ]; then
- mkdir -p "$(dirname "${DESKTOP_DST}")"
- # This file belongs to Fluorine, so refresh it on every launch. Older
- # releases advertised the main desktop entry as an NXM handler but did not
- # include %u; leaving that file in place causes portals to drop the URL and
- # launch a second argument-less process.
- BIN_DST_SED="$(printf '%s' "${BIN_DST}" | sed 's/[&|\\]/\\&/g')"
- DESKTOP_TMP="${DESKTOP_DST}.tmp.$$"
- if sed \
- -e "s|^Exec=fluorine-manager %u$|Exec=\"${BIN_DST_SED}/fluorine-manager\" %u|" \
- -e "s|^Exec=fluorine-manager |Exec=\"${BIN_DST_SED}/fluorine-manager\" |" \
- "${DESKTOP_SRC}" > "${DESKTOP_TMP}"; then
- chmod +x "${DESKTOP_TMP}"
- mv -f "${DESKTOP_TMP}" "${DESKTOP_DST}"
- command -v update-desktop-database >/dev/null 2>&1 && \
- update-desktop-database "$(dirname "${DESKTOP_DST}")" \
- >/dev/null 2>&1 || true
- else
- rm -f "${DESKTOP_TMP}"
- fi
-fi
+BIN_DST="/opt/fluorine-manager"
# Run from the synced location.
RUN="${BIN_DST}"
|