2 Commits

Author SHA1 Message Date
Don Williams
43adf21548 Arch(dev): AGS wrapper hardening — cd $HOME, proper --, GI paths, ensure ESM perms
- Wrapper now cds to $HOME, forwards args via "--" to avoid gjs parsing, expands GI_TYPELIB_PATH (incl. /usr/lib64/ags:/usr/lib/ags), and sets LD_LIBRARY_PATH for /usr/local libs.
- Ensure ESM entry com.github.Aylur.ags is 0644 under /usr/local/share and /usr/share.

Aligns Arch installer with Fedora fix; resolves "unknown option" and read-permission issues for `ags -t overview`.
2025-11-03 22:58:08 -05:00
Don Williams
7afaf65973 Arch: robust AGS v1.9.0 fix — env wrapper + hardened launcher patching
Problem
- AGS v1 under GJS ESM ignores GIR Repository.prepend_*; typelibs in /usr/local aren’t discovered reliably.
- On Arch, users may install AGS into /usr/local while system typelibs can also live under /usr/lib64/ags or /usr/lib/ags.

Solution
- Keep the tolerant ESM patcher (no-op safe): remove deprecated GIR repo calls; ensure GLib import; inject GI_TYPELIB_PATH via GLib.setenv when editing the ESM main.
- Add a distro-agnostic wrapper at /usr/local/bin/ags that sets:
  - GI_TYPELIB_PATH=/usr/local/lib64/girepository-1.0:/usr/local/lib/girepository-1.0:/usr/lib64/girepository-1.0:/usr/lib/girepository-1.0:/usr/local/lib64:/usr/local/lib:/usr/lib64/ags:/usr/lib/ags:$GI_TYPELIB_PATH
  - LD_LIBRARY_PATH=/usr/local/lib64:/usr/local/lib:$LD_LIBRARY_PATH
  Then execs: /usr/bin/gjs -m "$MAIN_JS" (resolved under /usr/local/share or /usr/share).

Why
- Ensures AGS v1 runs reliably on Arch without depending solely on fragile in-place edits; mirrors the working Fedora fix.

File
- install-scripts/ags.sh
2025-11-03 17:08:58 -05:00

View File

@@ -99,6 +99,27 @@ if git clone --depth=1 https://github.com/JaKooLit/ags_v1.9.0.git; then
sudo awk '{print} $0 ~ /^import GLib from "gi:\/\/GLib";$/ {print "const __old = GLib.getenv(\"GI_TYPELIB_PATH\");"; print "GLib.setenv(\"GI_TYPELIB_PATH\", \"/usr/local/lib\" + (__old ? \":\" + __old : \"\"), true);"}' "$LAUNCHER" | sudo tee "$LAUNCHER" >/dev/null sudo awk '{print} $0 ~ /^import GLib from "gi:\/\/GLib";$/ {print "const __old = GLib.getenv(\"GI_TYPELIB_PATH\");"; print "GLib.setenv(\"GI_TYPELIB_PATH\", \"/usr/local/lib\" + (__old ? \":\" + __old : \"\"), true);"}' "$LAUNCHER" | sudo tee "$LAUNCHER" >/dev/null
printf "${OK} AGS launcher patched.\n" printf "${OK} AGS launcher patched.\n"
# Create an env-setting wrapper for AGS to ensure GI typelibs/libs are discoverable
printf "${NOTE} Creating env wrapper /usr/local/bin/ags...\n"
MAIN_JS="/usr/local/share/com.github.Aylur.ags/com.github.Aylur.ags"
if ! sudo test -f "$MAIN_JS"; then
MAIN_JS="/usr/share/com.github.Aylur.ags/com.github.Aylur.ags"
fi
sudo tee /usr/local/bin/ags >/dev/null <<WRAP
#!/usr/bin/env bash
set -euo pipefail
cd "$HOME" 2>/dev/null || true
# Ensure GI typelibs and native libs are discoverable before gjs ESM loads
export GI_TYPELIB_PATH="/usr/local/lib64:/usr/local/lib:/usr/local/lib64/girepository-1.0:/usr/local/lib/girepository-1.0:/usr/lib64/girepository-1.0:/usr/lib/girepository-1.0:/usr/lib64/ags:/usr/lib/ags:${GI_TYPELIB_PATH-}"
export LD_LIBRARY_PATH="/usr/local/lib64:/usr/local/lib:${LD_LIBRARY_PATH-}"
exec /usr/bin/gjs -m "$MAIN_JS" -- "$@"
WRAP
sudo chmod 0755 /usr/local/bin/ags
# Ensure ESM entry is readable by gjs
sudo chmod 0644 /usr/local/share/com.github.Aylur.ags/com.github.Aylur.ags 2>/dev/null || true
sudo chmod 0644 /usr/share/com.github.Aylur.ags/com.github.Aylur.ags 2>/dev/null || true
printf "${OK} AGS wrapper installed at /usr/local/bin/ags\n"
else else
printf "${WARN} Launcher not found at $LAUNCHER, skipping patch.\n" printf "${WARN} Launcher not found at $LAUNCHER, skipping patch.\n"
fi fi