Skip to content

Commit 25c930d

Browse files
committed
part 13: LUCKY NUMBER 13?? --no-bump
1 parent c1daff6 commit 25c930d

1 file changed

Lines changed: 69 additions & 0 deletions

File tree

  • linux/packaging/appimage

linux/packaging/appimage/AppRun

Lines changed: 69 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
1+
#!/bin/bash
2+
3+
set -u
4+
5+
APPDIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
6+
SATURN_BIN="${APPDIR}/Saturn"
7+
8+
export LD_LIBRARY_PATH="${APPDIR}/lib:${APPDIR}/lib64"
9+
10+
SYSTEM_LIBDIRS=(
11+
"/usr/lib/x86_64-linux-gnu" # Debian/Ubuntu
12+
"/usr/lib64" # Fedora/RHEL/openSUSE (64-bit)
13+
"/usr/lib" # Generic (many distros)
14+
"/lib/x86_64-linux-gnu" # Debian/Ubuntu
15+
"/lib64" # Fedora/RHEL/openSUSE (64-bit)
16+
"/lib" # Generic (Arch, Alpine, etc.)
17+
"/usr/local/lib" # User-installed libraries
18+
"/usr/local/lib64" # User-installed libraries (64-bit)
19+
)
20+
21+
for libdir in "${SYSTEM_LIBDIRS[@]}"; do
22+
if [ -d "$libdir" ]; then
23+
export LD_LIBRARY_PATH="${LD_LIBRARY_PATH}:${libdir}"
24+
fi
25+
done
26+
27+
# Preserve any existing LD_LIBRARY_PATH from the user's environment
28+
if [ -n "${LD_LIBRARY_PATH:-}" ]; then
29+
export LD_LIBRARY_PATH="${LD_LIBRARY_PATH}:${LD_LIBRARY_PATH}"
30+
fi
31+
32+
if [ -x "$SATURN_BIN" ]; then
33+
# check if AOT library exists and is readable
34+
if [ -f "${APPDIR}/lib/libapp.so" ]; then
35+
export FLUTTER_AOT_LIBRARY="${APPDIR}/lib/libapp.so"
36+
fi
37+
exec "$SATURN_BIN" "$@"
38+
fi
39+
40+
# all common locations for the x86-64 dynamic linker
41+
DYNAMIC_LINKERS=(
42+
"/lib64/ld-linux-x86-64.so.2"
43+
"/lib/ld-linux-x86-64.so.2"
44+
"/lib/x86_64-linux-gnu/ld-linux-x86-64.so.2"
45+
"/usr/lib64/ld-linux-x86-64.so.2"
46+
"/usr/lib/ld-linux-x86-64.so.2"
47+
)
48+
49+
for ld_path in "${DYNAMIC_LINKERS[@]}"; do
50+
if [ -f "$ld_path" ]; then
51+
exec "$ld_path" --library-path "${LD_LIBRARY_PATH}" "$SATURN_BIN" "$@"
52+
fi
53+
done
54+
55+
# GG
56+
echo "Error: Failed to start Saturn" >&2
57+
echo "" >&2
58+
echo "Diagnostics:" >&2
59+
echo " Saturn binary: $SATURN_BIN" >&2
60+
echo " Binary exists: $([ -f "$SATURN_BIN" ] && echo "yes" || echo "no")" >&2
61+
echo " Binary executable: $([ -x "$SATURN_BIN" ] && echo "yes" || echo "no")" >&2
62+
echo " LD_LIBRARY_PATH: ${LD_LIBRARY_PATH}" >&2
63+
echo "" >&2
64+
echo "To fix this, ensure the following packages are installed:" >&2
65+
echo " Arch Linux: pacman -S gtk3 libayatana-appindicator" >&2
66+
echo " Debian/Ubuntu: apt install libgtk-3-0 libayatana-appindicator3-1" >&2
67+
echo " Fedora/RHEL: dnf install gtk3 libayatana-appindicator" >&2
68+
echo " openSUSE: zypper install gtk3 libayatana-appindicator3" >&2
69+
exit 1

0 commit comments

Comments
 (0)