install.sh: a Linux desktop gets the desktop app, or the command that installs its WebKitGTK; --gui and --tui choose (shuhai)
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.
This commit is contained in:
+17
-2
@@ -2562,13 +2562,28 @@ with a link builder: <https://usemagpie.ai/docs/import>.
|
||||
|
||||
Download the app for macOS, Windows or Linux from
|
||||
[usemagpie.ai](https://usemagpie.ai), or install it from a terminal (on
|
||||
Linux, the desktop app when WebKitGTK 4.1 is installed, the command
|
||||
otherwise):
|
||||
Linux, the desktop app when GTK 3 and WebKitGTK 4.1 are installed, the
|
||||
terminal build otherwise):
|
||||
|
||||
```sh
|
||||
curl -fsSL https://usemagpie.ai/install.sh | sh
|
||||
```
|
||||
|
||||
On Linux the installer asks nothing. A computer with a desktop (a
|
||||
graphical session, the user's graphical login when run over ssh, or a
|
||||
desktop installed in `xsessions` / `wayland-sessions`) but without the
|
||||
app's libraries gets the terminal build, and the installer ends with the
|
||||
command that installs them on that distribution (`sudo apt install
|
||||
libwebkit2gtk-4.1-0` on Debian and Ubuntu, `sudo dnf install
|
||||
webkit2gtk4.1` on Fedora, `sudo pacman -S --needed webkit2gtk-4.1` on
|
||||
Arch, `sudo zypper install libwebkit2gtk-4_1-0` on openSUSE); run it again
|
||||
afterwards for the app. `--gui` installs the app at once, before its
|
||||
libraries; `--tui` (or `MAGPIE_CLI=1`) installs the terminal build on a
|
||||
desktop too. The libraries are looked up with `ldconfig -p`, in `/sbin`
|
||||
as well, since a Debian user's `PATH` doesn't have it, and in the usual
|
||||
library folders where there is no cache. On musl (Alpine) it is always the
|
||||
terminal build.
|
||||
|
||||
Behind a firewall, or without access to GitHub, both the installer and
|
||||
`magpie update` take `--proxy <url>` (http, https, socks5, socks5h; or
|
||||
`MAGPIE_PROXY`, and `HTTPS_PROXY` / `ALL_PROXY` as usual) and
|
||||
|
||||
Reference in New Issue
Block a user