Files
proton-drive-linux/packaging/tarball/build.sh
T
nvrl a7baf2313c feat(packaging): an installable release tarball for immutable distributions (#99)
The release .tar.gz held the four binaries and their translations only,
and the service unit pointed at /usr/bin/pdfs, so it was no install on
its own. It now carries a /usr-like tree (bin, share, the user unit, the
tray's autostart entry) and install.sh, which installs it into ~/.local
without root:

- checks the libraries with ldd and names the packages to install per
  distribution, and that fusermount3 is there and setuid;
- refuses to install next to a package of the client;
- rewrites Exec= and ExecStart= to absolute paths, since ~/.local/bin is
  often not on a session's PATH;
- keeps a manifest, removes what an older version left, restarts a
  running service on update, and --uninstall leaves settings alone.

packaging/tarball/build.sh lays the tarball out and test.sh installs,
updates and uninstalls it in a throwaway home; the release job runs
both, CI runs shellcheck on them. The app looks for its translations in
share/locale beside its own bin directory and starts the tray from there,
so nothing needs PDFS_LOCALEDIR or the PATH. The -bin AUR package takes
every file from the new tarball instead of raw.githubusercontent.com.

INSTALL.md documents the tarball and layering the COPR package on Fedora
Atomic.
2026-11-15 23:57:01 +01:00

46 lines
1.7 KiB
Bash
Executable File

#!/usr/bin/env bash
# Lay out the release tarball: built binaries, desktop files, icon, user
# service, translations, shell completions and install.sh, under one top-level
# directory with a /usr-like tree, then pack it.
#
# usage: packaging/tarball/build.sh <binary dir> <version> <output dir>
# e.g. packaging/tarball/build.sh target/release 3.8.0 dist
# Writes <output dir>/proton-drive-linux-<version>-x86_64.tar.gz and prints
# its path.
set -euo pipefail
if [ $# -ne 3 ]; then
echo "usage: $0 <binary dir> <version> <output dir>" >&2
exit 2
fi
bin_dir="$1"
version="$2"
out="$3"
repo="$(cd "$(dirname "${BASH_SOURCE[0]}")/../.." && pwd)"
name="proton-drive-linux-$version-x86_64"
stage="$(mktemp -d)"
trap 'rm -rf "$stage"' EXIT
root="$stage/$name"
for exe in pdfs pdfs-app pdfs-tray pdfs-prompt; do
install -Dm755 "$bin_dir/$exe" "$root/bin/$exe"
done
install -Dm644 "$repo/packaging/io.narl.proton-drive-linux.desktop" \
"$root/share/applications/io.narl.proton-drive-linux.desktop"
install -Dm644 "$repo/packaging/io.narl.proton-drive-linux-tray.desktop" \
"$root/etc/xdg/autostart/io.narl.proton-drive-linux-tray.desktop"
install -Dm644 "$repo/packaging/io.narl.proton-drive-linux.svg" \
"$root/share/icons/hicolor/scalable/apps/io.narl.proton-drive-linux.svg"
install -Dm644 "$repo/packaging/proton-drive.service" \
"$root/lib/systemd/user/proton-drive.service"
install -Dm644 "$repo/LICENSE" "$root/share/licenses/proton-drive-linux/LICENSE"
"$repo/po/build.sh" "$root/share/locale"
"$repo/packaging/completions.sh" "$root/bin/pdfs" "$root/share"
install -Dm755 "$repo/packaging/tarball/install.sh" "$root/install.sh"
mkdir -p "$out"
tarball="$(cd "$out" && pwd)/$name.tar.gz"
tar -czf "$tarball" -C "$stage" --owner=0 --group=0 "$name"
echo "$tarball"