Files
plezy/linux/packaging/plezy.sh
edde746 32b3fb64a2 fix(linux): ship gio-launch-desktop so the bundled libgio can launch URLs
Root cause of the broken 'Sign in with Plex' and update links on
portable builds: the bundle ships Ubuntu's libgio, whose compiled-in
helper path (/usr/lib/x86_64-linux-gnu/glib-2.0/gio-launch-desktop)
exists only on Debian-family hosts. glib then falls back to a bare PATH
search, and distros like Fedora keep the helper in /usr/libexec outside
PATH, so every URL/desktop-file spawn failed. Installing the RPM masked
it only because system glib is built with the right path.

Bundle the build host's gio-launch-desktop next to the libgio it was
built with (bundle-libs.sh now fails the build if libgio is bundled and
the helper cannot be found) and export GIO_LAUNCH_DESKTOP from plezy.sh,
which glib checks before its compiled-in path. Covers the tarball and
the deb/rpm/pacman packages alike, since they all ship the same bundle
and launch through the wrapper.

close #1477
2026-08-20 13:31:16 +02:00

54 lines
1.8 KiB
Bash

#!/usr/bin/env bash
# Wrapper script for Plezy. Works for both:
# - Portable tarball (run from extracted directory)
# - System packages (/usr/bin/plezy -> /opt/plezy/)
# Resolve the real path of this script, following symlinks
SCRIPT_PATH="$(readlink -f "$0")"
INSTALL_DIR="$(dirname "$SCRIPT_PATH")"
# If we're in /usr/bin, the actual install is in /opt/plezy
if [[ "$INSTALL_DIR" == "/usr/bin" ]]; then
INSTALL_DIR="/opt/plezy"
fi
# Prepend bundled libraries to LD_LIBRARY_PATH
if [[ -d "$INSTALL_DIR/lib" ]]; then
export LD_LIBRARY_PATH="$INSTALL_DIR/lib${LD_LIBRARY_PATH:+:$LD_LIBRARY_PATH}"
fi
# gdk-pixbuf loaders
if [[ -f "$INSTALL_DIR/lib/gdk-pixbuf-2.0/2.10.0/loaders.cache" ]]; then
export GDK_PIXBUF_MODULE_FILE="$INSTALL_DIR/lib/gdk-pixbuf-2.0/2.10.0/loaders.cache"
fi
# GIO modules
if [[ -d "$INSTALL_DIR/lib/gio/modules" ]]; then
export GIO_MODULE_DIR="$INSTALL_DIR/lib/gio/modules"
fi
# gio-launch-desktop: the bundled libgio spawns URL/desktop-file handlers
# through this helper. Its compiled-in path only exists on the build distro
# and glib's PATH fallback misses hosts that keep it in /usr/libexec, which
# broke every URL launch (#1477). Point libgio at the bundled copy.
if [[ -x "$INSTALL_DIR/lib/glib-2.0/gio-launch-desktop" ]]; then
export GIO_LAUNCH_DESKTOP="$INSTALL_DIR/lib/glib-2.0/gio-launch-desktop"
fi
# GTK IM modules
if [[ -f "$INSTALL_DIR/lib/gtk-3.0/3.0.0/immodules.cache" ]]; then
export GTK_IM_MODULE_FILE="$INSTALL_DIR/lib/gtk-3.0/3.0.0/immodules.cache"
fi
# GTK module path (print backends, etc.)
if [[ -d "$INSTALL_DIR/lib/gtk-3.0" ]]; then
export GTK_PATH="$INSTALL_DIR/lib/gtk-3.0"
fi
# GSettings schemas
if [[ -d "$INSTALL_DIR/share/glib-2.0/schemas" ]]; then
export GSETTINGS_SCHEMA_DIR="$INSTALL_DIR/share/glib-2.0/schemas"
fi
exec "$INSTALL_DIR/plezy" "$@"