mirror of
https://github.com/narrrl/proton-drive-linux.git
synced 2026-11-16 09:51:59 +01:00
Compare commits
3
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
db8c0cb382 | ||
|
|
a7baf2313c | ||
|
|
7e0d7d020e |
No files matched your search
@@ -44,6 +44,9 @@ jobs:
|
||||
- name: Formatting
|
||||
run: cargo fmt --all -- --check
|
||||
|
||||
- name: Shell scripts of the release tarball
|
||||
run: shellcheck packaging/tarball/*.sh
|
||||
|
||||
- name: Lints
|
||||
run: cargo clippy --workspace --all-targets --locked -- -D warnings
|
||||
|
||||
|
||||
@@ -119,17 +119,12 @@ jobs:
|
||||
echo "VERSION=$VERSION" >> $GITHUB_ENV
|
||||
echo "Building version: $VERSION"
|
||||
|
||||
- name: Package raw binaries (.tar.gz)
|
||||
# Binaries plus everything around them, with install.sh for a home
|
||||
# directory install (immutable distributions, anything without a package).
|
||||
- name: Package the installable tarball (.tar.gz)
|
||||
run: |
|
||||
mkdir -p dist/binaries
|
||||
cp target/release/pdfs dist/binaries/
|
||||
cp target/release/pdfs-tray dist/binaries/
|
||||
cp target/release/pdfs-app dist/binaries/
|
||||
cp target/release/pdfs-prompt dist/binaries/
|
||||
po/build.sh dist/binaries/locale
|
||||
|
||||
# Create tarball
|
||||
tar -czf proton-drive-linux-${{ env.VERSION }}-x86_64.tar.gz -C dist/binaries .
|
||||
tarball=$(packaging/tarball/build.sh target/release "${{ env.VERSION }}" .)
|
||||
packaging/tarball/test.sh "$tarball"
|
||||
|
||||
# Every crate the build needs, so COPR can build the spec without network.
|
||||
- name: Package vendored crates (.tar.xz)
|
||||
|
||||
@@ -77,7 +77,8 @@ 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) |
|
||||
| Anything else | [Build from source](docs/INSTALL.md#build-from-source) |
|
||||
| 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) |
|
||||
| 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**
|
||||
|
||||
|
||||
@@ -344,7 +344,15 @@ fn present_window(app: &adw::Application) {
|
||||
|
||||
/// Spawn the tray icon process in the background.
|
||||
pub(crate) fn spawn_tray() {
|
||||
match Command::new("pdfs-tray").spawn() {
|
||||
// The tray installed next to this app, as the tray finds the app; the
|
||||
// bare name for a PATH install. An install into ~/.local is often not on
|
||||
// the PATH of a desktop session.
|
||||
let tray = std::env::current_exe()
|
||||
.ok()
|
||||
.and_then(|p| p.parent().map(|d| d.join("pdfs-tray")))
|
||||
.filter(|p| p.exists())
|
||||
.unwrap_or_else(|| PathBuf::from("pdfs-tray"));
|
||||
match Command::new(&tray).spawn() {
|
||||
Ok(child) => {
|
||||
tracing::info!("spawned `pdfs-tray`");
|
||||
pdfs_core::opener::reap(child);
|
||||
|
||||
@@ -13,6 +13,7 @@
|
||||
|
||||
use gettextrs::LocaleCategory;
|
||||
use pdfs_core::config::AppDirs;
|
||||
use std::path::{Path, PathBuf};
|
||||
|
||||
/// The gettext text domain, matching `po/pdfs.pot` and the installed `.mo` name.
|
||||
pub(crate) const DOMAIN: &str = "pdfs";
|
||||
@@ -53,14 +54,11 @@ pub(crate) fn init() {
|
||||
if let Some(code) = language {
|
||||
apply_language(&code);
|
||||
}
|
||||
let dir = std::env::var(LOCALEDIR_ENV)
|
||||
.ok()
|
||||
.filter(|dir| !dir.is_empty())
|
||||
.unwrap_or_else(|| {
|
||||
option_env!("PDFS_LOCALEDIR")
|
||||
.unwrap_or(DEFAULT_LOCALEDIR)
|
||||
.to_string()
|
||||
});
|
||||
let dir = locale_dir(
|
||||
std::env::var(LOCALEDIR_ENV).ok(),
|
||||
option_env!("PDFS_LOCALEDIR"),
|
||||
std::env::current_exe().ok(),
|
||||
);
|
||||
if let Err(e) = gettextrs::bindtextdomain(DOMAIN, dir) {
|
||||
tracing::warn!("bindtextdomain failed: {e}");
|
||||
}
|
||||
@@ -73,6 +71,33 @@ pub(crate) fn init() {
|
||||
}
|
||||
}
|
||||
|
||||
/// Where the catalogs are: `$PDFS_LOCALEDIR`, then the directory the build
|
||||
/// named, then `share/locale` beside the `bin` directory the program runs
|
||||
/// from when that holds a catalog of ours, then [`DEFAULT_LOCALEDIR`].
|
||||
///
|
||||
/// The third is for an install outside `/usr`, such as the release tarball's
|
||||
/// `install.sh` into `~/.local`: its programs find their translations without
|
||||
/// a wrapper setting the variable.
|
||||
fn locale_dir(env: Option<String>, build: Option<&str>, exe: Option<PathBuf>) -> PathBuf {
|
||||
if let Some(dir) = env.filter(|dir| !dir.is_empty()) {
|
||||
return PathBuf::from(dir);
|
||||
}
|
||||
if let Some(dir) = build {
|
||||
return PathBuf::from(dir);
|
||||
}
|
||||
let beside = exe
|
||||
.as_deref()
|
||||
.and_then(Path::parent)
|
||||
.and_then(Path::parent)
|
||||
.map(|prefix| prefix.join("share/locale"))
|
||||
.filter(|dir| {
|
||||
LANGUAGES
|
||||
.iter()
|
||||
.any(|(code, _)| dir.join(code).join("LC_MESSAGES/pdfs.mo").is_file())
|
||||
});
|
||||
beside.unwrap_or_else(|| PathBuf::from(DEFAULT_LOCALEDIR))
|
||||
}
|
||||
|
||||
/// The iso-codes text domain that translates ISO 3166-1 country names.
|
||||
const ISO_3166_DOMAIN: &str = "iso_3166-1";
|
||||
|
||||
@@ -234,6 +259,32 @@ fn fill(template: &str, args: &[(&str, &str)]) -> String {
|
||||
mod tests {
|
||||
use super::*;
|
||||
|
||||
#[test]
|
||||
fn the_catalogs_are_found_beside_an_install_outside_usr() {
|
||||
let prefix = std::env::temp_dir().join(format!("pdfs-locale-{}", std::process::id()));
|
||||
let mo = prefix.join("share/locale/de/LC_MESSAGES/pdfs.mo");
|
||||
std::fs::create_dir_all(mo.parent().unwrap()).unwrap();
|
||||
std::fs::write(&mo, b"").unwrap();
|
||||
let exe = Some(prefix.join("bin/pdfs-app"));
|
||||
|
||||
assert_eq!(
|
||||
locale_dir(None, None, exe.clone()),
|
||||
prefix.join("share/locale")
|
||||
);
|
||||
// The variable and the build's own choice still win.
|
||||
assert_eq!(
|
||||
locale_dir(Some("/x".into()), Some("/y"), exe.clone()),
|
||||
PathBuf::from("/x")
|
||||
);
|
||||
assert_eq!(locale_dir(None, Some("/y"), exe), PathBuf::from("/y"));
|
||||
// A prefix without our catalogs falls back to the system's.
|
||||
assert_eq!(
|
||||
locale_dir(None, None, Some(PathBuf::from("/nonexistent/bin/pdfs-app"))),
|
||||
PathBuf::from(DEFAULT_LOCALEDIR)
|
||||
);
|
||||
let _ = std::fs::remove_dir_all(&prefix);
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn fill_replaces_named_placeholders_in_any_order() {
|
||||
assert_eq!(
|
||||
|
||||
@@ -39,6 +39,15 @@ Existing folders stay device backups. Older builds cannot open the upgraded data
|
||||
folders, `.fuse_hidden*` and `.nfs*` leftovers, partial downloads (`*.part`, `*.crdownload`),
|
||||
Kate swap files and office lock files. This only changes folders where you never set your own
|
||||
list. Leaving a file out never deletes its copy on Proton Drive.
|
||||
- **An install without a package, for immutable distributions** (#99). The release `.tar.gz` now
|
||||
carries everything around the programs and an `install.sh` that installs them into your home
|
||||
folder, no root needed: `~/.local` for the programs, menu entry, icon, translations and shell
|
||||
completion, `~/.config` for the service and the tray's login entry. It checks the libraries
|
||||
first and names the packages to install, refuses to install next to a package of the client,
|
||||
updates in place (restarting a running service) and removes itself with `--uninstall`, leaving
|
||||
settings and data alone. The app finds its translations and the tray beside its own program, so
|
||||
nothing has to be on the `PATH`. [Installation](INSTALL.md) also shows how to layer the COPR
|
||||
package on Fedora Atomic (Silverblue, Kinoite, Bazzite, Bluefin).
|
||||
- **Sync a local folder with a folder you already have in My files** (#67, #77).
|
||||
`pdfs sync attach ~/Work --to Work` keeps `~/Work` an ordinary local folder and syncs it both
|
||||
ways with My files/Work. The first sync uploads files that are only on this computer, downloads
|
||||
|
||||
+49
-8
@@ -21,7 +21,8 @@ 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` |
|
||||
| [Anything else](#other-distributions) | `.tar.gz` from the release page, or [build from source](#build-from-source) | By hand |
|
||||
| [Fedora Atomic](#fedora-atomic-silverblue-kinoite-bazzite-bluefin) (Silverblue, Kinoite, Bazzite, Bluefin) | The COPR repository, layered with `rpm-ostree` | With `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
|
||||
Keyring, KWallet or KeePassXC, to keep your session. Most desktops have one already.
|
||||
@@ -139,12 +140,42 @@ the module) and a Secret Service such as GNOME Keyring or KWallet. To leave out
|
||||
it video thumbnails, override the package with `withFfmpeg = false`. The recipe is in
|
||||
[`packaging/nix/`](../packaging/nix/).
|
||||
|
||||
### 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:
|
||||
|
||||
```bash
|
||||
sudo curl -o /etc/yum.repos.d/proton-drive-linux.repo \
|
||||
"https://copr.fedorainfracloud.org/coprs/narl-rs/proton-drive-linux/repo/fedora-$(rpm -E %fedora)/narl-rs-proton-drive-linux-fedora-$(rpm -E %fedora).repo"
|
||||
rpm-ostree install proton-drive-linux
|
||||
systemctl reboot
|
||||
```
|
||||
|
||||
`rpm-ostree upgrade` brings new releases with the system's own updates.
|
||||
|
||||
### Other distributions
|
||||
|
||||
Unpack the `.tar.gz` from the [latest release](https://github.com/narrrl/proton-drive-linux/releases/latest)
|
||||
into a directory on your `PATH`, then install the service as shown in
|
||||
[Using a binary outside `/usr/bin`](#using-a-binary-outside-usrbin). The binaries need GTK 4.12,
|
||||
libadwaita 1.5, WebKitGTK 6.0 and FUSE 3; see [Requirements](#requirements).
|
||||
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:
|
||||
|
||||
```bash
|
||||
tar -xzf proton-drive-linux-*-x86_64.tar.gz
|
||||
proton-drive-linux-*-x86_64/install.sh
|
||||
```
|
||||
|
||||
It puts the programs in `~/.local/bin`, the menu entry, icon, translations and shell completion in
|
||||
`~/.local/share`, the service in `~/.config/systemd/user` and the tray's login entry in
|
||||
`~/.config/autostart`, each pointing at `~/.local/bin`. Then open **Proton Drive for Linux** from
|
||||
your applications menu. `--prefix DIR` installs somewhere else.
|
||||
|
||||
The system has to provide glibc 2.39 or newer (the binaries are built on Ubuntu 24.04), GTK 4.12,
|
||||
libadwaita 1.5, WebKitGTK 6.0 and FUSE 3 with a setuid `fusermount3`; see
|
||||
[Requirements](#requirements). `install.sh` checks the libraries first and names the packages to
|
||||
install for each distribution. It refuses to install next to a package of this client, since the
|
||||
two would run different versions of the service.
|
||||
|
||||
To update, download the new release and run its `install.sh`; a running service restarts on the new
|
||||
version. Turn on **Preferences → General → Check for updates** to hear about new releases.
|
||||
|
||||
## Optional extras
|
||||
|
||||
@@ -195,7 +226,9 @@ browser, solve it, then press Enter.
|
||||
| COPR (Fedora) | `sudo dnf upgrade` |
|
||||
| AUR | `paru -Syu`, or your AUR helper's equivalent |
|
||||
| Nix flake | `nix flake update proton-drive-linux`, or change the pinned tag, then rebuild |
|
||||
| `.deb`, release `.rpm`, `.tar.gz` | Download the new release and install it over the old one |
|
||||
| Fedora Atomic | `rpm-ostree upgrade`, then reboot |
|
||||
| `.deb`, release `.rpm` | Download the new release and install it over the old one |
|
||||
| `.tar.gz` | Download the new release and run its `install.sh` |
|
||||
|
||||
The service switches to the new version the next time it starts. To switch at once:
|
||||
|
||||
@@ -245,6 +278,8 @@ open in an older release, so going back to an older version means clearing the l
|
||||
| `.deb` | `sudo apt remove proton-drive-linux` |
|
||||
| AUR | `sudo pacman -R proton-drive-for-linux` (or the `-bin` or `-git` package) |
|
||||
| NixOS | Remove the module and the flake input, then rebuild |
|
||||
| Fedora Atomic | `rpm-ostree uninstall proton-drive-linux`, remove `/etc/yum.repos.d/proton-drive-linux.repo`, then reboot |
|
||||
| `.tar.gz` | `~/.local/share/proton-drive-linux/install.sh --uninstall` |
|
||||
|
||||
Removing the package also stops the service of every logged-in user, in case step 1 was
|
||||
skipped.
|
||||
@@ -353,8 +388,10 @@ sudo dnf install packaging/out/x86_64/proton-drive-linux-*.rpm
|
||||
|
||||
### Using a binary outside `/usr/bin`
|
||||
|
||||
The service unit starts `/usr/bin/pdfs daemon`. If you installed the programs somewhere else, for
|
||||
example `~/.local/bin`, install the unit for your user and point it at your binary:
|
||||
The release tarball's `install.sh` does all of this for you (see
|
||||
[Other distributions](#other-distributions)). For programs you built yourself: the service unit
|
||||
starts `/usr/bin/pdfs daemon`. If you installed the programs somewhere else, for example
|
||||
`~/.local/bin`, install the unit for your user and point it at your binary:
|
||||
|
||||
```bash
|
||||
mkdir -p ~/.config/systemd/user
|
||||
@@ -382,3 +419,7 @@ Every package installs the same files:
|
||||
| `/usr/lib/systemd/user/proton-drive.service` | User service that keeps the drive mounted |
|
||||
| `/etc/xdg/autostart/io.narl.proton-drive-linux-tray.desktop` | Starts the tray at login |
|
||||
| `/usr/share/locale/*/LC_MESSAGES/pdfs.mo` | Translations |
|
||||
|
||||
The release tarball's `install.sh` puts the same files under `~/.local` instead of `/usr`, the
|
||||
service in `~/.config/systemd/user` and the tray's login entry in `~/.config/autostart`. It keeps a
|
||||
list of them in `~/.local/share/proton-drive-linux/installed-files` for `--uninstall`.
|
||||
@@ -31,16 +31,6 @@ pkgbase = proton-drive-for-linux-bin
|
||||
options = !strip
|
||||
options = !debug
|
||||
source = proton-drive-linux-3.7.0-x86_64.tar.gz::https://github.com/narrrl/proton-drive-linux/releases/download/v3.7.0/proton-drive-linux-3.7.0-x86_64.tar.gz
|
||||
source = io.narl.proton-drive-linux-3.7.0.desktop::https://raw.githubusercontent.com/narrrl/proton-drive-linux/v3.7.0/packaging/io.narl.proton-drive-linux.desktop
|
||||
source = io.narl.proton-drive-linux-tray-3.7.0.desktop::https://raw.githubusercontent.com/narrrl/proton-drive-linux/v3.7.0/packaging/io.narl.proton-drive-linux-tray.desktop
|
||||
source = io.narl.proton-drive-linux-3.7.0.svg::https://raw.githubusercontent.com/narrrl/proton-drive-linux/v3.7.0/packaging/io.narl.proton-drive-linux.svg
|
||||
source = proton-drive-3.7.0.service::https://raw.githubusercontent.com/narrrl/proton-drive-linux/v3.7.0/packaging/proton-drive.service
|
||||
source = LICENSE-3.7.0::https://raw.githubusercontent.com/narrrl/proton-drive-linux/v3.7.0/LICENSE
|
||||
sha256sums = 3f0d16c19b10b30e3f181e3c7fb439f0a8c38980e8ab7a4a96ae6596b349787c
|
||||
sha256sums = d190d6771fff0b975271fb62fd3fb0fa8bbf17d7278c10853c18557855b0c123
|
||||
sha256sums = 1d95e250370220e3bb6aead6ce34d1d6cc759f42c4803b75f1667e78ff47c6c0
|
||||
sha256sums = e598a93c2715c3a9fdc7fb937902083d4a1135e8fbdfe6fe7e37f0383ebbd828
|
||||
sha256sums = 44c25dca6e759c46fca50b58099aa6194abe78293dee07d971bbbce0ff3ca58f
|
||||
sha256sums = 02c419e7f9af08dda720e4f852f3e57cf5a69e192605440f750e9d244fa2817c
|
||||
sha256sums = SKIP
|
||||
|
||||
pkgname = proton-drive-for-linux-bin
|
||||
@@ -25,54 +25,37 @@ options=('!strip' '!debug')
|
||||
# Stops the running daemon before removal, so the mount stops mirroring deletes.
|
||||
install=proton-drive.install
|
||||
_tag="v$pkgver"
|
||||
_raw="https://raw.githubusercontent.com/narrrl/proton-drive-linux/$_tag"
|
||||
# The release tarball holds the four binaries only, so the desktop integration
|
||||
# files come straight from the tagged tree. Every one carries $pkgver in its
|
||||
# name: makepkg reuses a cached file of the same name, so an unversioned name
|
||||
# keeps the old copy after upstream changes it and fails the checksum.
|
||||
source=("proton-drive-linux-$pkgver-x86_64.tar.gz::$_repo/releases/download/$_tag/proton-drive-linux-$pkgver-x86_64.tar.gz"
|
||||
"io.narl.proton-drive-linux-$pkgver.desktop::$_raw/packaging/io.narl.proton-drive-linux.desktop"
|
||||
"io.narl.proton-drive-linux-tray-$pkgver.desktop::$_raw/packaging/io.narl.proton-drive-linux-tray.desktop"
|
||||
"io.narl.proton-drive-linux-$pkgver.svg::$_raw/packaging/io.narl.proton-drive-linux.svg"
|
||||
"proton-drive-$pkgver.service::$_raw/packaging/proton-drive.service"
|
||||
"LICENSE-$pkgver::$_raw/LICENSE")
|
||||
sha256sums=('3f0d16c19b10b30e3f181e3c7fb439f0a8c38980e8ab7a4a96ae6596b349787c'
|
||||
'd190d6771fff0b975271fb62fd3fb0fa8bbf17d7278c10853c18557855b0c123'
|
||||
'1d95e250370220e3bb6aead6ce34d1d6cc759f42c4803b75f1667e78ff47c6c0'
|
||||
'e598a93c2715c3a9fdc7fb937902083d4a1135e8fbdfe6fe7e37f0383ebbd828'
|
||||
'44c25dca6e759c46fca50b58099aa6194abe78293dee07d971bbbce0ff3ca58f'
|
||||
'02c419e7f9af08dda720e4f852f3e57cf5a69e192605440f750e9d244fa2817c')
|
||||
# The release tarball holds the binaries and everything installed around them
|
||||
# (desktop files, icon, user service, translations, completions) in a /usr-like
|
||||
# tree under one directory.
|
||||
source=("proton-drive-linux-$pkgver-x86_64.tar.gz::$_repo/releases/download/$_tag/proton-drive-linux-$pkgver-x86_64.tar.gz")
|
||||
sha256sums=('SKIP')
|
||||
|
||||
package() {
|
||||
install -Dm755 "$srcdir/pdfs" "$pkgdir/usr/bin/pdfs"
|
||||
install -Dm755 "$srcdir/pdfs-tray" "$pkgdir/usr/bin/pdfs-tray"
|
||||
install -Dm755 "$srcdir/pdfs-app" "$pkgdir/usr/bin/pdfs-app"
|
||||
install -Dm755 "$srcdir/pdfs-prompt" "$pkgdir/usr/bin/pdfs-prompt"
|
||||
cd "$srcdir/proton-drive-linux-$pkgver-x86_64"
|
||||
local exe
|
||||
for exe in pdfs pdfs-tray pdfs-app pdfs-prompt; do
|
||||
install -Dm755 "bin/$exe" "$pkgdir/usr/bin/$exe"
|
||||
done
|
||||
|
||||
install -Dm644 "$srcdir/io.narl.proton-drive-linux-$pkgver.desktop" \
|
||||
install -Dm644 share/applications/io.narl.proton-drive-linux.desktop \
|
||||
"$pkgdir/usr/share/applications/io.narl.proton-drive-linux.desktop"
|
||||
install -Dm644 "$srcdir/io.narl.proton-drive-linux-tray-$pkgver.desktop" \
|
||||
install -Dm644 etc/xdg/autostart/io.narl.proton-drive-linux-tray.desktop \
|
||||
"$pkgdir/etc/xdg/autostart/io.narl.proton-drive-linux-tray.desktop"
|
||||
install -Dm644 "$srcdir/io.narl.proton-drive-linux-$pkgver.svg" \
|
||||
install -Dm644 share/icons/hicolor/scalable/apps/io.narl.proton-drive-linux.svg \
|
||||
"$pkgdir/usr/share/icons/hicolor/scalable/apps/io.narl.proton-drive-linux.svg"
|
||||
|
||||
# systemd user unit for the auto-mount daemon; enabled per user, not by pacman.
|
||||
install -Dm644 "$srcdir/proton-drive-$pkgver.service" \
|
||||
install -Dm644 lib/systemd/user/proton-drive.service \
|
||||
"$pkgdir/usr/lib/systemd/user/proton-drive.service"
|
||||
|
||||
# Translations ship precompiled in the release tarball.
|
||||
# Translations and shell completion for bash, zsh and fish.
|
||||
install -dm755 "$pkgdir/usr/share"
|
||||
cp -r --no-preserve=ownership "$srcdir/locale" "$pkgdir/usr/share/locale"
|
||||
cp -r --no-preserve=ownership share/locale share/bash-completion share/zsh share/fish \
|
||||
"$pkgdir/usr/share/"
|
||||
|
||||
# Shell completion for bash, zsh and fish, written by the binary itself.
|
||||
local share="$pkgdir/usr/share"
|
||||
install -d "$share/bash-completion/completions" "$share/zsh/site-functions" \
|
||||
"$share/fish/vendor_completions.d"
|
||||
"$srcdir/pdfs" completions bash > "$share/bash-completion/completions/pdfs"
|
||||
"$srcdir/pdfs" completions zsh > "$share/zsh/site-functions/_pdfs"
|
||||
"$srcdir/pdfs" completions fish > "$share/fish/vendor_completions.d/pdfs.fish"
|
||||
|
||||
install -Dm644 "$srcdir/LICENSE-$pkgver" "$pkgdir/usr/share/licenses/$pkgname/LICENSE"
|
||||
install -Dm644 share/licenses/proton-drive-linux/LICENSE \
|
||||
"$pkgdir/usr/share/licenses/$pkgname/LICENSE"
|
||||
|
||||
# pacman brings new releases, so the app never checks for them itself.
|
||||
install -Dm644 /dev/null "$pkgdir/usr/share/proton-drive-linux/managed-updates"
|
||||
|
||||
Executable
+45
@@ -0,0 +1,45 @@
|
||||
#!/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"
|
||||
Executable
+194
@@ -0,0 +1,194 @@
|
||||
#!/usr/bin/env bash
|
||||
# Install Proton Drive for Linux from this release tarball into your home
|
||||
# directory, or remove it again. Needs no root, so it works on distributions
|
||||
# where the system is read-only, as long as GTK 4, libadwaita, WebKitGTK 6 and
|
||||
# FUSE 3 are on the system.
|
||||
set -Eeuo pipefail
|
||||
|
||||
usage() {
|
||||
cat >&2 <<'EOF'
|
||||
usage: ./install.sh [--prefix DIR] [--no-service] [--force]
|
||||
./install.sh --uninstall [--prefix DIR] [--no-service]
|
||||
|
||||
Installs the app, the tray, the search launcher and the `pdfs` command into
|
||||
~/.local (bin/, share/), the background service into ~/.config/systemd/user and
|
||||
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.
|
||||
|
||||
--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
|
||||
--no-service leave systemd alone (no reload, restart or stop)
|
||||
--force install although libraries are missing or a package
|
||||
already installs Proton Drive for Linux
|
||||
EOF
|
||||
exit 2
|
||||
}
|
||||
|
||||
prefix=""
|
||||
uninstall=0
|
||||
service=1
|
||||
force=0
|
||||
while [[ $# -gt 0 ]]; do
|
||||
case "$1" in
|
||||
--prefix) [[ $# -ge 2 ]] || usage; prefix="$2"; shift ;;
|
||||
--prefix=*) prefix="${1#*=}" ;;
|
||||
--uninstall) uninstall=1 ;;
|
||||
--no-service) service=0 ;;
|
||||
--force) force=1 ;;
|
||||
-h | --help) usage ;;
|
||||
*) echo "unknown option: $1" >&2; usage ;;
|
||||
esac
|
||||
shift
|
||||
done
|
||||
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
|
||||
prefix="$(dirname "$(dirname "$here")")"
|
||||
fi
|
||||
prefix="${prefix:-$HOME/.local}"
|
||||
[[ "$prefix" == /* ]] || prefix="$PWD/$prefix"
|
||||
prefix="${prefix%/}"
|
||||
|
||||
config_home="${XDG_CONFIG_HOME:-$HOME/.config}"
|
||||
unit_dir="$config_home/systemd/user"
|
||||
autostart_dir="$config_home/autostart"
|
||||
data_dir="$prefix/share/proton-drive-linux"
|
||||
manifest="$data_dir/installed-files"
|
||||
unit=proton-drive.service
|
||||
|
||||
say() { printf '%s\n' "$*"; }
|
||||
warn() { printf 'warning: %s\n' "$*" >&2; }
|
||||
die() { printf 'error: %s\n' "$*" >&2; exit 1; }
|
||||
|
||||
systemctl_user() {
|
||||
[[ $service -eq 1 ]] || return 0
|
||||
command -v systemctl >/dev/null || return 0
|
||||
systemctl --user "$@" 2>/dev/null || true
|
||||
}
|
||||
|
||||
# Remove every file listed in the manifest `$1` that is not in the list `$2`
|
||||
# (one path per line), then the directories that leaves empty.
|
||||
remove_listed() {
|
||||
local list="$1" keep="${2:-}" path
|
||||
[[ -f "$list" ]] || return 0
|
||||
while IFS= read -r path; do
|
||||
[[ -n "$path" ]] || continue
|
||||
if [[ -n "$keep" ]] && grep -Fxq -- "$path" <<<"$keep"; then
|
||||
continue
|
||||
fi
|
||||
rm -f -- "$path"
|
||||
rmdir -p --ignore-fail-on-non-empty -- "$(dirname -- "$path")" 2>/dev/null || true
|
||||
done <"$list"
|
||||
}
|
||||
|
||||
if [[ $uninstall -eq 1 ]]; then
|
||||
[[ -f "$manifest" ]] || die "nothing installed under $prefix (no $manifest)"
|
||||
# Stopping unmounts My files; queued changes stay and upload on the next start.
|
||||
systemctl_user disable --now "$unit"
|
||||
remove_listed "$manifest"
|
||||
rm -f -- "$manifest" "$data_dir/install.sh"
|
||||
rmdir --ignore-fail-on-non-empty -- "$data_dir" 2>/dev/null || true
|
||||
systemctl_user daemon-reload
|
||||
say "Removed Proton Drive for Linux from $prefix."
|
||||
say "Your settings, cache and sign-in stay; see the uninstall section of docs/INSTALL.md to remove them too."
|
||||
exit 0
|
||||
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.
|
||||
missing="$(for exe in pdfs pdfs-app pdfs-tray pdfs-prompt; do
|
||||
ldd "$here/bin/$exe" 2>&1 | grep -E 'not found' || true
|
||||
done | sort -u)"
|
||||
if [[ -n "$missing" ]]; then
|
||||
printf '%s\n' "$missing" | sed 's/^[[:space:]]*/ /' >&2
|
||||
if grep -q 'GLIBC_' <<<"$missing"; then
|
||||
warn "these binaries need glibc 2.39 or newer (Ubuntu 24.04, Debian 13, Fedora 40)"
|
||||
fi
|
||||
cat >&2 <<'EOF'
|
||||
Install the missing libraries, then run this again:
|
||||
Fedora, Fedora Atomic gtk4 libadwaita webkitgtk6.0 fuse3
|
||||
(on Silverblue and its siblings, layer the COPR package
|
||||
instead: see docs/INSTALL.md)
|
||||
Debian, Ubuntu libgtk-4-1 libadwaita-1-0 libwebkitgtk-6.0-4 fuse3
|
||||
Arch Linux gtk4 libadwaita webkitgtk-6.0 fuse3
|
||||
openSUSE libgtk-4-1 libadwaita-1-0 libwebkitgtk-6_0-4 fuse3
|
||||
EOF
|
||||
[[ $force -eq 1 ]] || die "missing libraries (--force installs anyway)"
|
||||
fi
|
||||
|
||||
fusermount="$(command -v fusermount3 || true)"
|
||||
if [[ -z "$fusermount" ]]; then
|
||||
warn "fusermount3 is missing; install fuse3, or My files cannot be mounted"
|
||||
elif [[ ! -u "$fusermount" ]]; then
|
||||
warn "$fusermount is not setuid root; My files may not mount"
|
||||
fi
|
||||
|
||||
# Where each file of the tarball goes, as "source<TAB>target" lines.
|
||||
targets() {
|
||||
local file rel
|
||||
while IFS= read -r -d '' file; do
|
||||
rel="${file#"$here"/}"
|
||||
case "$rel" in
|
||||
bin/* | share/*) printf '%s\t%s\n' "$rel" "$prefix/$rel" ;;
|
||||
lib/systemd/user/*) printf '%s\t%s\n' "$rel" "$unit_dir/${rel##*/}" ;;
|
||||
etc/xdg/autostart/*) printf '%s\t%s\n' "$rel" "$autostart_dir/${rel##*/}" ;;
|
||||
esac
|
||||
done < <(find "$here/bin" "$here/share" "$here/lib" "$here/etc" -type f -print0 | sort -z)
|
||||
}
|
||||
|
||||
# A desktop entry and a unit file take a quoted path; double quotes and
|
||||
# backslashes inside it are escaped.
|
||||
quoted() {
|
||||
local path="${1//\\/\\\\}"
|
||||
printf '"%s"' "${path//\"/\\\"}"
|
||||
}
|
||||
|
||||
new_files=""
|
||||
while IFS=$'\t' read -r rel target; do
|
||||
mode=644
|
||||
[[ "$rel" == bin/* ]] && mode=755
|
||||
install -Dm"$mode" -- "$here/$rel" "$target"
|
||||
case "$rel" in
|
||||
share/applications/*.desktop | etc/xdg/autostart/*.desktop)
|
||||
exe="$(sed -n 's/^Exec=\([^ ]*\).*/\1/p' "$target" | head -n1)"
|
||||
sed -i "s|^Exec=$exe|Exec=$(quoted "$prefix/bin/$exe" | sed 's/[&|]/\\&/g')|" "$target"
|
||||
;;
|
||||
lib/systemd/user/*)
|
||||
sed -i "s|^ExecStart=/usr/bin/pdfs|ExecStart=$(quoted "$prefix/bin/pdfs" | sed 's/[&|]/\\&/g')|" "$target"
|
||||
;;
|
||||
esac
|
||||
new_files+="$target"$'\n'
|
||||
done < <(targets)
|
||||
|
||||
# Drop what an older version installed and this one does not.
|
||||
remove_listed "$manifest" "$new_files"
|
||||
mkdir -p -- "$data_dir"
|
||||
printf '%s' "$new_files" >"$manifest"
|
||||
install -m755 -- "$here/install.sh" "$data_dir/install.sh"
|
||||
|
||||
if command -v gtk-update-icon-cache >/dev/null &&
|
||||
[[ -f "$prefix/share/icons/hicolor/index.theme" ]]; then
|
||||
gtk-update-icon-cache -q -t "$prefix/share/icons/hicolor" 2>/dev/null || true
|
||||
fi
|
||||
|
||||
systemctl_user daemon-reload
|
||||
if [[ $service -eq 1 ]] && command -v systemctl >/dev/null &&
|
||||
systemctl --user is-active -q "$unit" 2>/dev/null; then
|
||||
systemctl --user restart "$unit" && say "Restarted the running service on the new version."
|
||||
fi
|
||||
|
||||
say "Installed Proton Drive for Linux $("$prefix/bin/pdfs" --version 2>/dev/null | awk '{print $NF}') into $prefix."
|
||||
say "Open \"Proton Drive for Linux\" from your applications menu and sign in; the app starts the service."
|
||||
case ":$PATH:" in
|
||||
*":$prefix/bin:"*) ;;
|
||||
*) say "To use \`pdfs\` in a terminal, add $prefix/bin to your PATH." ;;
|
||||
esac
|
||||
say "To update, run install.sh from a newer tarball. To remove: $data_dir/install.sh --uninstall"
|
||||
Executable
+69
@@ -0,0 +1,69 @@
|
||||
#!/usr/bin/env bash
|
||||
# Check a release tarball: install it into a throwaway home, check that every
|
||||
# file landed with its paths rewritten and that the programs run, update it in
|
||||
# place, then uninstall and check nothing is left. Touches no real home and no
|
||||
# systemd (--no-service).
|
||||
#
|
||||
# usage: packaging/tarball/test.sh <tarball>
|
||||
set -euo pipefail
|
||||
|
||||
if [ $# -ne 1 ]; then
|
||||
echo "usage: $0 <tarball>" >&2
|
||||
exit 2
|
||||
fi
|
||||
tarball="$(cd "$(dirname "$1")" && pwd)/$(basename "$1")"
|
||||
work="$(mktemp -d)"
|
||||
trap 'rm -rf "$work"' EXIT
|
||||
|
||||
fail() { echo "FAIL: $*" >&2; exit 1; }
|
||||
|
||||
tar -xzf "$tarball" -C "$work"
|
||||
src="$(find "$work" -mindepth 1 -maxdepth 1 -type d -name 'proton-drive-linux-*')"
|
||||
[ -x "$src/install.sh" ] || fail "no install.sh in the tarball"
|
||||
|
||||
export HOME="$work/home" XDG_CONFIG_HOME="$work/home/.config"
|
||||
mkdir -p "$HOME"
|
||||
prefix="$HOME/.local"
|
||||
"$src/install.sh" --no-service --force >"$work/install.log" 2>&1 ||
|
||||
{ cat "$work/install.log" >&2; fail "install.sh failed"; }
|
||||
|
||||
for exe in pdfs pdfs-app pdfs-tray pdfs-prompt; do
|
||||
[ -x "$prefix/bin/$exe" ] || fail "$exe was not installed"
|
||||
done
|
||||
"$prefix/bin/pdfs" --version >/dev/null || fail "pdfs does not run"
|
||||
app="$prefix/share/applications/io.narl.proton-drive-linux.desktop"
|
||||
tray="$XDG_CONFIG_HOME/autostart/io.narl.proton-drive-linux-tray.desktop"
|
||||
unit="$XDG_CONFIG_HOME/systemd/user/proton-drive.service"
|
||||
grep -qx "Exec=\"$prefix/bin/pdfs-app\"" "$app" || fail "the app's Exec= was not rewritten: $(grep ^Exec= "$app")"
|
||||
grep -qx "Exec=\"$prefix/bin/pdfs-tray\"" "$tray" || fail "the tray's Exec= was not rewritten: $(grep ^Exec= "$tray")"
|
||||
grep -qx "ExecStart=\"$prefix/bin/pdfs\" daemon" "$unit" || fail "ExecStart= was not rewritten: $(grep ^ExecStart= "$unit")"
|
||||
[ -f "$prefix/share/locale/de/LC_MESSAGES/pdfs.mo" ] || fail "no translations"
|
||||
[ -f "$prefix/share/icons/hicolor/scalable/apps/io.narl.proton-drive-linux.svg" ] || fail "no icon"
|
||||
[ -f "$prefix/share/bash-completion/completions/pdfs" ] || fail "no bash completion"
|
||||
[ ! -e "$prefix/share/proton-drive-linux/managed-updates" ] || fail "the update check must stay on offer"
|
||||
uninstaller="$prefix/share/proton-drive-linux/install.sh"
|
||||
[ -x "$uninstaller" ] || fail "install.sh was not kept for --uninstall"
|
||||
|
||||
# An update from the same tarball leaves the same files.
|
||||
before="$(cd "$work/home" && find . -type f | sort)"
|
||||
"$src/install.sh" --no-service --force >"$work/update.log" 2>&1 ||
|
||||
{ cat "$work/update.log" >&2; fail "updating failed"; }
|
||||
after="$(cd "$work/home" && find . -type f | sort)"
|
||||
[ "$before" = "$after" ] || fail "an update changed the set of files: $(diff <(echo "$before") <(echo "$after"))"
|
||||
|
||||
# A file an older version installed and this one does not is removed.
|
||||
stale="$prefix/share/locale/xx/LC_MESSAGES/pdfs.mo"
|
||||
mkdir -p "$(dirname "$stale")" && : >"$stale"
|
||||
echo "$stale" >>"$prefix/share/proton-drive-linux/installed-files"
|
||||
"$src/install.sh" --no-service --force >/dev/null 2>&1
|
||||
[ ! -e "$stale" ] || fail "a file the new version does not ship was left behind"
|
||||
|
||||
# Settings are not the installer's: uninstalling keeps them.
|
||||
mkdir -p "$XDG_CONFIG_HOME/proton-drive-linux"
|
||||
echo '{}' >"$XDG_CONFIG_HOME/proton-drive-linux/config.json"
|
||||
"$uninstaller" --uninstall --no-service >"$work/uninstall.log" 2>&1 ||
|
||||
{ cat "$work/uninstall.log" >&2; fail "uninstall failed"; }
|
||||
left="$(cd "$work/home" && find . -type f | sort)"
|
||||
[ "$left" = "./.config/proton-drive-linux/config.json" ] || fail "uninstall left files behind: $left"
|
||||
|
||||
echo "tarball OK: $(basename "$tarball")"
|
||||
Reference in new issue
Block a user