shuhai on Discord: on a Linux desktop install.sh installed the terminal
build, and a desktop user expects the app. The script chose by
`ldconfig -p` alone, and on Debian a user's PATH has no /sbin, so
ldconfig wasn't found and every Debian desktop got the terminal build
even with WebKitGTK 4.1 installed. Without the libraries, the only hint
was a line mid-output.
Now, with nothing asked (curl | sh stays unattended):
- the libraries are looked up with ldconfig from PATH, /sbin or /usr/sbin,
and in the usual lib folders when there is no cache (NixOS, Guix);
GTK 3 is checked beside WebKitGTK 4.1, which brings the rest the app
links (readelf -d of v0.1.2359's magpie-linux-amd64: gtk-3, webkit2gtk-4.1,
soup-3.0, javascriptcoregtk-4.1, glib, X11, wayland-client, glibc);
- libraries there: the desktop app, as before;
- a desktop without them: the terminal build, and last in the output the
distribution's command (apt/dnf/pacman/zypper/xbps/emerge from
os-release ID and ID_LIKE), "run this again", or --gui. A desktop is
DISPLAY, WAYLAND_DISPLAY, XDG_CURRENT_DESKTOP/XDG_SESSION_DESKTOP/
DESKTOP_SESSION, XDG_SESSION_TYPE x11/wayland, the user's logind
Display session when its Type is x11/wayland/mir (over ssh; logind
falls back to a tty login, which doesn't count), or a session file in
xsessions/wayland-sessions under XDG_DATA_DIRS;
- headless without them: the terminal build, with no desktop advice;
- --gui: the app even before its libraries, with the package to add;
--tui (or MAGPIE_CLI=1, kept) the terminal build on a desktop too;
- musl (Alpine): always the terminal build; --gui refuses, since the
app is built against glibc.
Docs: reference.md Install, README en/zh, docs start FAQ (en/zh/ja,
#linux-build).
Run:
- shellcheck -s sh: only SC2010 at the uninstall's `ls | grep`, there
before this change. sh -n and dash -n clean.
- site/install.test.mjs (5 new tests): 19/19 on mote (macOS sh) and on
magpie-desktop through wsl-run (dash); CI's site step
(sh -n + node --test site/*.test.mjs) 58/58 on magpie-desktop and 58/58
on mote.
- Red on the old install.sh: tests 16-19 fail (desktop advice, headless
advice, --gui, --tui). With the logind Type check taken out by hand,
the headless test fails on login "135 tty".
- Real installs on magpie-desktop (Ubuntu 24.04, XFCE, WSLg, /bin/sh =
dash), `cat install.sh | env ... sh -s`, stdin a pipe, into a /tmp
sandbox HOME/XDG dirs/MAGPIE_BIN_DIR, each removed after, v0.1.2360
downloaded from the real feed and `magpie version` run:
session with DISPLAY/WAYLAND_DISPLAY: desktop app + menu entry;
env -i with PATH=/usr/local/bin:/usr/bin:/bin: desktop app (the old
script gave the terminal build here, run the same way);
an ldconfig whose cache lacks the libs + DISPLAY=:0, and the same in
env -i (found by /usr/share/xsessions): terminal build + the apt line;
that with XDG_DATA_DIRS=/nonexistent: terminal build, quiet; --gui
there: desktop app + the apt line; --tui in the session: terminal build.
The first run found the tty-login fallback (logind's Display=135 is
this WSL user's pts session), fixed before commit.
- site/install.test.mjs on Windows (win-run): 0/19, the same 14 old
tests too: the box has no sh for spawnSync; CI runs this file on Linux
only.
Not tried: a real Debian, Fedora, Arch or openSUSE box, or a box without
WebKitGTK installed (simulated with a fake ldconfig); the package names
were checked against each index (Ubuntu noble, Debian bookworm, Arch,
Fedora mdapi, Tumbleweed oss, void-packages, Gentoo), not installed. The
installed app wasn't opened (only `magpie version`), to keep off ports
other sessions use there. Termux and macOS paths are unchanged and their
tests pass.