Skip to content

Open-source download manager & offline media toolbox for YouTube, music, social media, learning platforms & 1,800+ sites. Built with Tauri 2.0, Rust & Svelte.

fix(build): keep the patched AppImage plugin inside the project

Yahya Zekry57b2095b928b
diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml
index c50cdfaa..5c1d01ad 100644
--- a/.github/workflows/release.yml
+++ b/.github/workflows/release.yml
@@ -75,7 +75,7 @@ jobs:
LDAI_UPDATE_INFORMATION: ${{ contains(matrix.platform, 'ubuntu') && 'gh-releases-zsync|tonhowtf|omniget|latest|*AppImage.zsync' || '' }}
# linuxdeploy bundles an old `strip` that fails on modern .relr.dyn
# relocations; disable stripping so AppImage bundling succeeds.
- NO_STRIP: '1'
+ NO_STRIP: ${{ contains(matrix.platform, 'ubuntu') && '1' || '' }}
NODE_OPTIONS: --max-old-space-size=6144
with:
tagName: v__VERSION__
diff --git a/README.md b/README.md
index 2d5d531d..e5953f3f 100644
--- a/README.md
+++ b/README.md
@@ -383,6 +383,8 @@ pnpm tauri build --config '{"bundle":{"createUpdaterArtifacts":false}}'
Releases sign their updater artifacts with a private key only the maintainers hold, so a plain `pnpm tauri build` stops at the bundling step with *"A public key has been found, but no private key"*. The flag above turns those artifacts off for your local build — everything else is identical. It is passed on the command line rather than committed to `tauri.conf.json` on purpose: a config that disables them by default would silently ship a release with no signatures and break the auto-updater for everyone.
+On Linux, build the AppImage with `pnpm tauri:appimage` instead. It wraps the same flag and adds two things a plain `tauri build --bundles appimage` gets wrong outside of CI: it skips the strip step that fails on the `.relr.dyn` sections newer linkers emit, and it hands the bundler a patched `linuxdeploy-plugin-gtk.sh` that survives distros shipping builtin gdk-pixbuf loaders (Arch, among others). The patched plugin goes into this project's `src-tauri/target/.tauri/`, not the shared `~/.cache/tauri/`, so it never leaks into your other Tauri projects — `cargo clean` removes it.
+
### Command line interface
The repository also contains `omniget-cli`, a small Rust binary that makes OmniGet scriptable. It ships with every release — grab `omniget-cli-<version>-<target>` from the [latest release](https://github.com/tonhowtf/omniget/releases/latest) for Windows, macOS (Intel and Apple Silicon) or Linux. To build it from this repository instead:
diff --git a/package.json b/package.json
index a54c9bfb..062fc743 100644
--- a/package.json
+++ b/package.json
@@ -11,7 +11,7 @@
"check": "svelte-kit sync && svelte-check --tsconfig ./tsconfig.json",
"check:watch": "svelte-kit sync && svelte-check --tsconfig ./tsconfig.json --watch",
"tauri": "tauri",
- "tauri:appimage": "sh -c 'mkdir -p ~/.cache/tauri && cp scripts/linux/linuxdeploy-plugin-gtk.sh ~/.cache/tauri/ && chmod +x ~/.cache/tauri/linuxdeploy-plugin-gtk.sh' && NO_STRIP=1 tauri build --bundles appimage --config '{\"bundle\":{\"createUpdaterArtifacts\":false}}'",
+ "tauri:appimage": "bash scripts/linux/appimage.sh",
"version:set": "node scripts/bump-version.js",
"generate:i18n-keys": "node scripts/generate-i18n-keys.js",
"check:i18n": "node scripts/generate-i18n-keys.js --strict",
diff --git a/scripts/linux/appimage.sh b/scripts/linux/appimage.sh
new file mode 100755
index 00000000..a6737f06
--- /dev/null
+++ b/scripts/linux/appimage.sh
@@ -0,0 +1,29 @@
+#! /usr/bin/env bash
+#
+# Builds the Linux AppImage with our patched linuxdeploy-plugin-gtk.
+#
+# The Tauri bundler downloads linuxdeploy-plugin-gtk.sh once and never
+# re-checks it, so dropping our copy where it looks pins that copy for every
+# later build. We therefore turn on `bundle.useLocalToolsDir`, which moves the
+# bundler's tool cache from the shared ~/.cache/tauri into this project's cargo
+# target directory. Nothing outside the repo is touched, and `cargo clean`
+# undoes it.
+
+set -e
+
+cd "$(dirname "$0")/../.."
+
+target_dir=$(cargo metadata --no-deps --format-version 1 \
+ --manifest-path src-tauri/Cargo.toml |
+ node -e 'let s="";process.stdin.on("data",c=>s+=c).on("end",()=>console.log(JSON.parse(s).target_directory))')
+
+tools_dir="$target_dir/.tauri"
+mkdir -p "$tools_dir"
+cp scripts/linux/linuxdeploy-plugin-gtk.sh "$tools_dir/"
+chmod +x "$tools_dir/linuxdeploy-plugin-gtk.sh"
+echo "Using patched linuxdeploy-plugin-gtk.sh from $tools_dir"
+
+# NO_STRIP: linuxdeploy's strip step fails on the .relr.dyn sections newer
+# linkers emit. createUpdaterArtifacts: a local build has no signing key.
+exec env NO_STRIP=1 node_modules/.bin/tauri build --bundles appimage \
+ --config '{"bundle":{"useLocalToolsDir":true,"createUpdaterArtifacts":false}}' "$@"
diff --git a/scripts/linux/linuxdeploy-plugin-gtk.sh b/scripts/linux/linuxdeploy-plugin-gtk.sh
index 89e8f26a..4a3f6fe2 100755
--- a/scripts/linux/linuxdeploy-plugin-gtk.sh
+++ b/scripts/linux/linuxdeploy-plugin-gtk.sh
@@ -1,5 +1,40 @@
#! /usr/bin/env bash
+# Vendored copy of linuxdeploy-plugin-gtk, patched for OmniGet.
+#
+# Source: https://github.com/tauri-apps/linuxdeploy-plugin-gtk
+# (a fork of https://github.com/linuxdeploy/linuxdeploy-plugin-gtk)
+# Copied at: commit b5eb8d05b4c0ed40107fe2158c5d8527f94568ef (2024-01-04)
+# This is the exact URL the Tauri bundler fetches at
+# tauri-bundler/src/bundle/linux/appimage/linuxdeploy.rs.
+#
+# License: MIT. Copyright 2018-2019 TheAssassin and the linuxdeploy
+# contributors. Permission is hereby granted, free of charge, to any
+# person obtaining a copy of this software and associated
+# documentation files (the "Software"), to deal in the Software
+# without restriction, including without limitation the rights to
+# use, copy, modify, merge, publish, distribute, sublicense, and/or
+# sell copies of the Software, and to permit persons to whom the
+# Software is furnished to do so, subject to the following
+# conditions: the above copyright notice and this permission notice
+# shall be included in all copies or substantial portions of the
+# Software. THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF
+# ANY KIND, EXPRESS OR IMPLIED. See LICENSE.txt in the upstream
+# repository for the full text.
+#
+# Local modifications (everything else is byte-identical to upstream):
+# 1. copy_tree() skips sources that do not exist instead of aborting the
+# build. Arch ships builtin gdk-pixbuf loaders, so the pkg-config paths
+# upstream trusts can point at files that are not there.
+# 2. The gdk-pixbuf loaders.cache directory is created before the cache is
+# written, so the query tool has somewhere to write to.
+# 3. The `sed -i` on loaders.cache moved inside the `-f` guard. Upstream ran
+# it unconditionally, so a missing cache tripped `set -e` right after
+# warning that it was only a warning.
+#
+# Re-syncing: diff this file against the upstream URL above, re-apply the three
+# hunks, and update the commit and date recorded here.
+
# GTK3 environment variables: https://developer.gnome.org/gtk3/stable/gtk-running.html
# GTK4 environment variables: https://developer.gnome.org/gtk4/stable/gtk-running.html