Skip to content

Commit af843d0

Browse files
committed
fix(installer): support TUXEDO OS and silence KDE Plasma 6 qtpaths noise
- Resolve derivative distros to their base family via ID_LIKE (with a package-manager fallback) so TUXEDO OS (ID=tuxedo), Pop!_OS, Zorin, elementary, etc. install instead of failing 'Unsupported distribution'. - In set_default_application, drop the dead qtpaths PATH-munging block and filter the cosmetic 'qtpaths: not found' stderr that xdg-mime emits on Qt6-only KDE systems (TUXEDO OS, Ubuntu 24.04 KDE). The default is still set via xdg-mime's generic backend; only the noise is removed. Applied identically to installer.sh and installer-latest-experimental-build.sh.
1 parent 65df054 commit af843d0

2 files changed

Lines changed: 108 additions & 52 deletions

File tree

docs/linux/installer-latest-experimental-build.sh

Lines changed: 54 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -265,6 +265,38 @@ install_packages_for_distro() {
265265
esac
266266
}
267267

268+
# Resolves the running distro to one of the package-manager families the
269+
# installer knows how to drive: ubuntu/debian (apt), fedora/rhel (dnf), or arch
270+
# (pacman). Directly-named IDs map to themselves; derivative distros that aren't
271+
# listed explicitly — TUXEDO OS (tuxedo), Pop!_OS (pop), Zorin, elementary,
272+
# EndeavourOS, Nobara, Raspbian, … — resolve through their ID_LIKE chain, and
273+
# as a last resort we key off whichever package manager is actually installed.
274+
# Echoes the family on success; returns 1 only for a truly unknown system.
275+
resolve_distro_family() {
276+
local id="$1" id_like="$2" token
277+
# 1. IDs the per-distro install logic already handles by name.
278+
case "$id" in
279+
ubuntu|debian|linuxmint|kali|neon|fedora|rhel|centos|arch|manjaro|cachyos)
280+
echo "$id"; return 0 ;;
281+
esac
282+
# 2. Walk ID_LIKE (space-separated, most-derived first) for a known base.
283+
# e.g. TUXEDO OS ships ID_LIKE="ubuntu debian" -> ubuntu.
284+
# shellcheck disable=SC2086
285+
for token in $id_like; do
286+
case "$token" in
287+
ubuntu|debian|fedora|rhel|centos|arch) echo "$token"; return 0 ;;
288+
esac
289+
done
290+
# 3. Fall back to the installed package manager. Package *names* differ
291+
# between families but are identical within one (the apt branch picks
292+
# libfuse2 vs libfuse2t64 by repo query), so any apt host can be driven as
293+
# debian, any dnf host as fedora, any pacman host as arch.
294+
if command -v apt-get >/dev/null 2>&1; then echo debian; return 0; fi
295+
if command -v dnf >/dev/null 2>&1; then echo fedora; return 0; fi
296+
if command -v pacman >/dev/null 2>&1; then echo arch; return 0; fi
297+
return 1
298+
}
299+
268300
# Decides what (if anything) the user's system is missing for Phoenix Code to
269301
# run, then installs only the missing piece(s). Three independent probes:
270302
#
@@ -283,13 +315,14 @@ ensure_runtime_dependencies() {
283315
fi
284316
. /etc/os-release
285317
local distro="${ID:-}"
286-
case "$distro" in
287-
ubuntu|debian|linuxmint|kali|neon|fedora|rhel|centos|arch|manjaro|cachyos) ;;
288-
*)
289-
echo -e "${RED}Unsupported distribution: $distro. Please install libfuse2/fuse2, libsecret, and (on non-KDE) gnome-keyring manually.${RESET}"
290-
exit 1
291-
;;
292-
esac
318+
local family
319+
if ! family=$(resolve_distro_family "$distro" "${ID_LIKE:-}"); then
320+
echo -e "${RED}Unsupported distribution: ${distro:-unknown}. Please install libfuse2/fuse2, libsecret, and (on non-KDE) gnome-keyring manually.${RESET}"
321+
exit 1
322+
fi
323+
if [ "$family" != "$distro" ]; then
324+
echo -e "${GREEN}Detected '$distro'; installing dependencies as '$family'-compatible.${RESET}"
325+
fi
293326
local keyring; keyring=$(gnome_keyring_pkg_if_needed)
294327

295328
local libs_ok=1 keyring_ok=1
@@ -311,7 +344,7 @@ ensure_runtime_dependencies() {
311344
echo "Please enter your password to proceed."
312345
fi
313346

314-
install_packages_for_distro "$distro" "$keyring"
347+
install_packages_for_distro "$family" "$keyring"
315348
# Re-probe libraries; if still failing, surface a clear warning but don't
316349
# abort — the AppImage may have a runtime-specific issue we can't fix here.
317350
if [ "$libs_ok" = 0 ] && ! verify_appimage_launches "$appimage"; then
@@ -367,29 +400,24 @@ print_keyring_hint_if_locked() {
367400
set_default_application() {
368401
local desktop_file="$DESKTOP_ENTRY_NAME"
369402

370-
if [ "${KDE_SESSION_VERSION:-0}" -gt 0 ] && ! command -v qtpaths &> /dev/null; then
371-
local qtpaths_locations=(
372-
"/usr/lib/qt6/bin"
373-
"/usr/lib/qt5/bin"
374-
"/usr/lib64/qt6/bin"
375-
"/usr/lib64/qt5/bin"
376-
"/opt/qt6/bin"
377-
"/opt/qt5/bin"
378-
)
379-
for qtpath_dir in "${qtpaths_locations[@]}"; do
380-
if [ -x "$qtpath_dir/qtpaths" ] || [ -x "$qtpath_dir/qtpaths6" ]; then
381-
export PATH="$qtpath_dir:$PATH"
382-
break
383-
fi
384-
done
385-
fi
386-
403+
# `xdg-mime default` sets the system default opener by writing [Default
404+
# Applications] to ~/.config/mimeapps.list (its generic backend), which works on
405+
# every desktop. On KDE it ALSO runs a qtpaths-based backend that is redundant
406+
# for us; on Qt6-only systems (TUXEDO OS, Ubuntu 24.04 KDE, Fedora KDE) the
407+
# `qtpaths` CLI is absent, so that backend prints a harmless "qtpaths: not found"
408+
# per mimetype while the default is still set correctly. Collect stderr and drop
409+
# only that cosmetic line, letting any genuine error through.
410+
local mime_err
411+
mime_err=$(mktemp)
387412
for mime_type in "${MIME_TYPES[@]}"; do
388413
if [ "$mime_type" = "text/html" ]; then
389414
continue
390415
fi
391-
xdg-mime default "$desktop_file" "$mime_type"
416+
xdg-mime default "$desktop_file" "$mime_type" 2>>"$mime_err"
392417
done
418+
grep -vE 'qtpaths.*not found' "$mime_err" >&2 || true
419+
rm -f "$mime_err"
420+
393421
echo -e "${GREEN}Success! You can now right-click on files in your file manager and choose Phoenix Code to edit them.${RESET}"
394422
}
395423

docs/linux/installer.sh

Lines changed: 54 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -265,6 +265,38 @@ install_packages_for_distro() {
265265
esac
266266
}
267267

268+
# Resolves the running distro to one of the package-manager families the
269+
# installer knows how to drive: ubuntu/debian (apt), fedora/rhel (dnf), or arch
270+
# (pacman). Directly-named IDs map to themselves; derivative distros that aren't
271+
# listed explicitly — TUXEDO OS (tuxedo), Pop!_OS (pop), Zorin, elementary,
272+
# EndeavourOS, Nobara, Raspbian, … — resolve through their ID_LIKE chain, and
273+
# as a last resort we key off whichever package manager is actually installed.
274+
# Echoes the family on success; returns 1 only for a truly unknown system.
275+
resolve_distro_family() {
276+
local id="$1" id_like="$2" token
277+
# 1. IDs the per-distro install logic already handles by name.
278+
case "$id" in
279+
ubuntu|debian|linuxmint|kali|neon|fedora|rhel|centos|arch|manjaro|cachyos)
280+
echo "$id"; return 0 ;;
281+
esac
282+
# 2. Walk ID_LIKE (space-separated, most-derived first) for a known base.
283+
# e.g. TUXEDO OS ships ID_LIKE="ubuntu debian" -> ubuntu.
284+
# shellcheck disable=SC2086
285+
for token in $id_like; do
286+
case "$token" in
287+
ubuntu|debian|fedora|rhel|centos|arch) echo "$token"; return 0 ;;
288+
esac
289+
done
290+
# 3. Fall back to the installed package manager. Package *names* differ
291+
# between families but are identical within one (the apt branch picks
292+
# libfuse2 vs libfuse2t64 by repo query), so any apt host can be driven as
293+
# debian, any dnf host as fedora, any pacman host as arch.
294+
if command -v apt-get >/dev/null 2>&1; then echo debian; return 0; fi
295+
if command -v dnf >/dev/null 2>&1; then echo fedora; return 0; fi
296+
if command -v pacman >/dev/null 2>&1; then echo arch; return 0; fi
297+
return 1
298+
}
299+
268300
# Decides what (if anything) the user's system is missing for Phoenix Code to
269301
# run, then installs only the missing piece(s). Three independent probes:
270302
#
@@ -283,13 +315,14 @@ ensure_runtime_dependencies() {
283315
fi
284316
. /etc/os-release
285317
local distro="${ID:-}"
286-
case "$distro" in
287-
ubuntu|debian|linuxmint|kali|neon|fedora|rhel|centos|arch|manjaro|cachyos) ;;
288-
*)
289-
echo -e "${RED}Unsupported distribution: $distro. Please install libfuse2/fuse2, libsecret, and (on non-KDE) gnome-keyring manually.${RESET}"
290-
exit 1
291-
;;
292-
esac
318+
local family
319+
if ! family=$(resolve_distro_family "$distro" "${ID_LIKE:-}"); then
320+
echo -e "${RED}Unsupported distribution: ${distro:-unknown}. Please install libfuse2/fuse2, libsecret, and (on non-KDE) gnome-keyring manually.${RESET}"
321+
exit 1
322+
fi
323+
if [ "$family" != "$distro" ]; then
324+
echo -e "${GREEN}Detected '$distro'; installing dependencies as '$family'-compatible.${RESET}"
325+
fi
293326
local keyring; keyring=$(gnome_keyring_pkg_if_needed)
294327

295328
local libs_ok=1 keyring_ok=1
@@ -311,7 +344,7 @@ ensure_runtime_dependencies() {
311344
echo "Please enter your password to proceed."
312345
fi
313346

314-
install_packages_for_distro "$distro" "$keyring"
347+
install_packages_for_distro "$family" "$keyring"
315348
# Re-probe libraries; if still failing, surface a clear warning but don't
316349
# abort — the AppImage may have a runtime-specific issue we can't fix here.
317350
if [ "$libs_ok" = 0 ] && ! verify_appimage_launches "$appimage"; then
@@ -367,29 +400,24 @@ print_keyring_hint_if_locked() {
367400
set_default_application() {
368401
local desktop_file="$DESKTOP_ENTRY_NAME"
369402

370-
if [ "${KDE_SESSION_VERSION:-0}" -gt 0 ] && ! command -v qtpaths &> /dev/null; then
371-
local qtpaths_locations=(
372-
"/usr/lib/qt6/bin"
373-
"/usr/lib/qt5/bin"
374-
"/usr/lib64/qt6/bin"
375-
"/usr/lib64/qt5/bin"
376-
"/opt/qt6/bin"
377-
"/opt/qt5/bin"
378-
)
379-
for qtpath_dir in "${qtpaths_locations[@]}"; do
380-
if [ -x "$qtpath_dir/qtpaths" ] || [ -x "$qtpath_dir/qtpaths6" ]; then
381-
export PATH="$qtpath_dir:$PATH"
382-
break
383-
fi
384-
done
385-
fi
386-
403+
# `xdg-mime default` sets the system default opener by writing [Default
404+
# Applications] to ~/.config/mimeapps.list (its generic backend), which works on
405+
# every desktop. On KDE it ALSO runs a qtpaths-based backend that is redundant
406+
# for us; on Qt6-only systems (TUXEDO OS, Ubuntu 24.04 KDE, Fedora KDE) the
407+
# `qtpaths` CLI is absent, so that backend prints a harmless "qtpaths: not found"
408+
# per mimetype while the default is still set correctly. Collect stderr and drop
409+
# only that cosmetic line, letting any genuine error through.
410+
local mime_err
411+
mime_err=$(mktemp)
387412
for mime_type in "${MIME_TYPES[@]}"; do
388413
if [ "$mime_type" = "text/html" ]; then
389414
continue
390415
fi
391-
xdg-mime default "$desktop_file" "$mime_type"
416+
xdg-mime default "$desktop_file" "$mime_type" 2>>"$mime_err"
392417
done
418+
grep -vE 'qtpaths.*not found' "$mime_err" >&2 || true
419+
rm -f "$mime_err"
420+
393421
echo -e "${GREEN}Success! You can now right-click on files in your file manager and choose Phoenix Code to edit them.${RESET}"
394422
}
395423

0 commit comments

Comments
 (0)