From 73e2d1ec53ab67b9e6cb3fe5bf38ef84d5bf598c Mon Sep 17 00:00:00 2001 From: Nils Pukropp Date: Tue, 24 Nov 2026 21:11:52 +0100 Subject: [PATCH] fix(packaging): check tarball compatibility before installation --- README.md | 2 +- docs/INSTALL.md | 9 ++++++--- docs/SYNCED_FOLDERS.md | 1 + packaging/tarball/install.sh | 36 +++++++++++++++++++++++++++++------- packaging/tarball/test.sh | 13 +++++++++++++ 5 files changed, 50 insertions(+), 11 deletions(-) diff --git a/README.md b/README.md index c0e8057..21e69c8 100644 --- a/README.md +++ b/README.md @@ -77,7 +77,7 @@ scriptable CLI. | Arch Linux | [`proton-drive-for-linux`](https://aur.archlinux.org/packages/proton-drive-for-linux) (also `-bin` and `-git`) in the AUR | | Debian, Ubuntu 24.04 or newer | `.deb` from the [latest release](https://github.com/narrrl/proton-drive-linux/releases/latest) | | NixOS | The flake in this repository: see [Installation → NixOS](docs/INSTALL.md#nixos-flake) | -| Fedora Atomic (Silverblue, Kinoite, Bazzite, Bluefin) | The COPR repository, layered with `rpm-ostree`: see [Installation → Fedora Atomic](docs/INSTALL.md#fedora-atomic-silverblue-kinoite-bazzite-bluefin) | +| Fedora Atomic (Silverblue, Kinoite, Bazzite, Bluefin) | A home-directory tarball or a COPR package layered with `rpm-ostree`. See [Installation → Fedora Atomic](docs/INSTALL.md#fedora-atomic-silverblue-kinoite-bazzite-bluefin) | | Anything else, immutable ones included | `.tar.gz` from the [latest release](https://github.com/narrrl/proton-drive-linux/releases/latest), installed into your home folder by its `install.sh`: see [Installation → Other distributions](docs/INSTALL.md#other-distributions), or [build from source](docs/INSTALL.md#build-from-source) | **Fedora** diff --git a/docs/INSTALL.md b/docs/INSTALL.md index 57d7dec..1789e83 100644 --- a/docs/INSTALL.md +++ b/docs/INSTALL.md @@ -21,7 +21,7 @@ again. | [Arch Linux](#arch-linux-aur) | `proton-drive-for-linux` in the AUR | With your AUR helper | | [Debian, Ubuntu 24.04 or newer](#debian-and-ubuntu-2404-or-newer) | `.deb` from the release page | Download each release | | [NixOS](#nixos-flake) | The flake in this repository | With `nix flake update` | -| [Fedora Atomic](#fedora-atomic-silverblue-kinoite-bazzite-bluefin) (Silverblue, Kinoite, Bazzite, Bluefin) | The COPR repository, layered with `rpm-ostree` | With `rpm-ostree upgrade` | +| [Fedora Atomic](#fedora-atomic-silverblue-kinoite-bazzite-bluefin) (Silverblue, Kinoite, Bazzite, Bluefin) | Home-directory tarball or COPR package layered with `rpm-ostree` | Rerun the tarball installer or use `rpm-ostree upgrade` | | [Anything else](#other-distributions), immutable ones included | `.tar.gz` from the release page, installed into your home folder by its `install.sh`, or [build from source](#build-from-source) | Run the new release's `install.sh` | Release packages are for x86_64. You also need a Secret Service provider, such as GNOME @@ -142,7 +142,9 @@ it video thumbnails, override the package with `withFfmpeg = false`. The recipe ### Fedora Atomic (Silverblue, Kinoite, Bazzite, Bluefin) -The system is read-only, so layer the COPR package on top of it. It brings its libraries along: +To install in your home folder, unpack the x86-64 tarball and run its +`install.sh --check` on the host desktop. See [Other distributions](#other-distributions). +For installation and updates through the system image, layer the COPR package: ```bash sudo curl -o /etc/yum.repos.d/proton-drive-linux.repo \ @@ -156,10 +158,11 @@ systemctl reboot ### Other distributions The `.tar.gz` from the [latest release](https://github.com/narrrl/proton-drive-linux/releases/latest) -installs into your home folder, without root, so it also works where the system is read-only: +installs into your home folder, without root, on hosts that provide its runtime dependencies. Check those before installing: ```bash tar -xzf proton-drive-linux-*-x86_64.tar.gz +proton-drive-linux-*-x86_64/install.sh --check proton-drive-linux-*-x86_64/install.sh ``` diff --git a/docs/SYNCED_FOLDERS.md b/docs/SYNCED_FOLDERS.md index 9513fec..18dbb13 100644 --- a/docs/SYNCED_FOLDERS.md +++ b/docs/SYNCED_FOLDERS.md @@ -128,6 +128,7 @@ pdfs sync ignore reset # back to the built-in patterns pdfs sync ignore add 'cache/' --folder ~/Projects # only in ~/Projects/.pdfsignore pdfs sync ignore list --folder ~/Projects pdfs sync ignore check ~/Projects/app/node_modules +pdfs sync ignore check ~/Projects/data/cache.db # shows which rule applies ``` The rules apply to folders kept on this computer. Files you save into `~/ProtonDrive` itself or into diff --git a/packaging/tarball/install.sh b/packaging/tarball/install.sh index df33c46..ae0c367 100755 --- a/packaging/tarball/install.sh +++ b/packaging/tarball/install.sh @@ -8,6 +8,7 @@ set -Eeuo pipefail usage() { cat >&2 <<'EOF' usage: ./install.sh [--prefix DIR] [--no-service] [--force] + ./install.sh --check ./install.sh --uninstall [--prefix DIR] [--no-service] Installs the app, the tray, the search launcher and the `pdfs` command into @@ -15,6 +16,7 @@ Installs the app, the tray, the search launcher and the `pdfs` command into the tray's login entry into ~/.config/autostart. Run it again from a newer tarball to update; the running service restarts on the new version. + --check check the binary and host requirements without installing files --prefix DIR install under DIR instead of ~/.local --uninstall remove what an earlier run installed; your settings, cache and the files in Proton Drive stay @@ -26,6 +28,7 @@ EOF } prefix="" +check=0 uninstall=0 service=1 force=0 @@ -33,6 +36,7 @@ while [[ $# -gt 0 ]]; do case "$1" in --prefix) [[ $# -ge 2 ]] || usage; prefix="$2"; shift ;; --prefix=*) prefix="${1#*=}" ;; + --check) check=1 ;; --uninstall) uninstall=1 ;; --no-service) service=0 ;; --force) force=1 ;; @@ -41,6 +45,7 @@ while [[ $# -gt 0 ]]; do esac shift done +(( !check || (!uninstall && !force) )) || usage here="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" # The copy kept for --uninstall knows where it was installed. if [[ -z "$prefix" && -f "$here/installed-files" ]]; then @@ -97,15 +102,17 @@ fi [[ -x "$here/bin/pdfs" ]] || die "run install.sh from the unpacked tarball (no bin/pdfs next to it)" -# A package and this install would each bring a service unit, and the one in -# ~/.config wins: the two would run different versions against one database. -if [[ $force -eq 0 && ( -e /usr/bin/pdfs || -e /usr/lib/systemd/user/$unit ) ]]; then - die "a package already installs Proton Drive for Linux (/usr/bin/pdfs). Remove it first, or keep using it." -fi - # Missing libraries would only show when the app does not start. +if [[ "$(uname -m)" != x86_64 ]]; then + die "this binary tarball requires an x86-64 Linux host" +fi +command -v ldd >/dev/null || die "ldd is required to check the tarball's shared libraries" missing="$(for exe in pdfs pdfs-app pdfs-tray pdfs-prompt; do - ldd "$here/bin/$exe" 2>&1 | grep -E 'not found' || true + if output="$(LC_ALL=C ldd "$here/bin/$exe" 2>&1)"; then + grep -F 'not found' <<<"$output" || true + else + printf '%s: %s\n' "$exe" "$output" + fi done | sort -u)" if [[ -n "$missing" ]]; then printf '%s\n' "$missing" | sed 's/^[[:space:]]*/ /' >&2 @@ -131,6 +138,21 @@ elif [[ ! -u "$fusermount" ]]; then warn "$fusermount is not setuid root; My files may not mount" fi +if [[ $check -eq 1 ]]; then + [[ -n "$fusermount" && -u "$fusermount" && "$(stat -Lc %u "$fusermount")" == 0 ]] || + die "the mount requires a setuid-root fusermount3" + [[ -c /dev/fuse && -r /dev/fuse && -w /dev/fuse ]] || die "the current user needs access to /dev/fuse" + "$here/bin/pdfs" --version + say "The binaries load and the FUSE helper is available. Sign-in and mounting require a desktop session." + exit 0 +fi + +# A package and this install would each bring a service unit, and the one in +# ~/.config wins: the two would run different versions against one database. +if [[ $force -eq 0 && ( -e /usr/bin/pdfs || -e /usr/lib/systemd/user/$unit ) ]]; then + die "a package already installs Proton Drive for Linux (/usr/bin/pdfs). Remove it first, or keep using it." +fi + # Where each file of the tarball goes, as "sourcetarget" lines. targets() { local file rel diff --git a/packaging/tarball/test.sh b/packaging/tarball/test.sh index 697b56f..07f0ab6 100755 --- a/packaging/tarball/test.sh +++ b/packaging/tarball/test.sh @@ -24,6 +24,19 @@ src="$(find "$work" -mindepth 1 -maxdepth 1 -type d -name 'proton-drive-linux-*' export HOME="$work/home" XDG_CONFIG_HOME="$work/home/.config" mkdir -p "$HOME" prefix="$HOME/.local" +# Exercise the failure path independently of this host's own packages. +mkdir "$work/tools" +cat >"$work/tools/ldd" <<'EOF' +#!/bin/sh +echo 'libmissing.so => not found' +EOF +chmod +x "$work/tools/ldd" +if PATH="$work/tools:$PATH" "$src/install.sh" --check >"$work/check.log" 2>&1; then + fail "compatibility check accepted a missing library" +fi +grep -q 'libmissing.so' "$work/check.log" || fail "check did not name the missing library" +[ -z "$(find "$HOME" -mindepth 1 -print -quit)" ] || fail "compatibility check wrote into HOME" + "$src/install.sh" --no-service --force >"$work/install.log" 2>&1 || { cat "$work/install.log" >&2; fail "install.sh failed"; }