Fixing ags script for overview launcher
On branch development Your branch is up to date with 'origin/development'. Changes to be committed: modified: install-scripts/ags.sh
This commit is contained in:
@@ -118,28 +118,56 @@ if git clone --depth=1 https://github.com/JaKooLit/ags_v1.9.0.git; then
|
|||||||
echo -e "\n${ERROR} ${YELLOW}Aylur's GTK shell $ags_tag${RESET} Installation failed\n " 2>&1 | tee -a "$MLOG"
|
echo -e "\n${ERROR} ${YELLOW}Aylur's GTK shell $ags_tag${RESET} Installation failed\n " 2>&1 | tee -a "$MLOG"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
LAUNCHER="/usr/local/share/com.github.Aylur.ags/com.github.Aylur.ags"
|
LAUNCHER_DIR="/usr/local/share/com.github.Aylur.ags"
|
||||||
if sudo test -f "$LAUNCHER"; then
|
LAUNCHER_PATH="$LAUNCHER_DIR/com.github.Aylur.ags"
|
||||||
# 1) Switch from GIRepository ESM import to GLib and drop deprecated prepend_* calls
|
sudo mkdir -p "$LAUNCHER_DIR"
|
||||||
sudo sed -i \
|
|
||||||
-e 's|^import GIR from "gi://GIRepository?version=2.0";$|import GLib from "gi://GLib";|' \
|
|
||||||
-e '/GIR.Repository.prepend_search_path/d' \
|
|
||||||
-e '/GIR.Repository.prepend_library_path/d' \
|
|
||||||
"$LAUNCHER"
|
|
||||||
|
|
||||||
# 2) Inject GI_TYPELIB_PATH export right after the GLib import
|
# Install a known-good launcher that sets GI_TYPELIB_PATH so GUtils and other
|
||||||
# IMPORTANT: never read and write the same file in one pipeline; it can truncate to 0 bytes.
|
# typelibs can be found, matching the working setup on jak-cachy.
|
||||||
# Write to a temp file and then move it into place.
|
sudo tee "$LAUNCHER_PATH" >/dev/null <<'EOF'
|
||||||
if ! sudo grep -q 'GLib.setenv("GI_TYPELIB_PATH"' "$LAUNCHER"; then
|
#!/usr/sbin/gjs -m
|
||||||
TMP_FILE="$(mktemp)"
|
|
||||||
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 "$TMP_FILE" >/dev/null
|
|
||||||
sudo mv "$TMP_FILE" "$LAUNCHER"
|
|
||||||
fi
|
|
||||||
|
|
||||||
printf "${OK} AGS launcher patched.\n"
|
import { exit, programArgs, programInvocationName } from "system";
|
||||||
else
|
import GLib from "gi://GLib";
|
||||||
printf "${WARN} Launcher not found at $LAUNCHER, skipping patch.\n"
|
|
||||||
fi
|
GLib.setenv("GI_TYPELIB_PATH", "/usr/local/lib:/usr/lib/girepository-1.0", true);
|
||||||
|
|
||||||
|
imports.package.init({
|
||||||
|
name: "com.github.Aylur.ags",
|
||||||
|
version: "1.9.0",
|
||||||
|
prefix: "/usr/local",
|
||||||
|
libdir: "/usr/local/lib",
|
||||||
|
});
|
||||||
|
|
||||||
|
const module = await import("resource:///com/github/Aylur/ags/main.js");
|
||||||
|
const exitCode = await module.main([programInvocationName, ...programArgs]);
|
||||||
|
exit(exitCode);
|
||||||
|
EOF
|
||||||
|
|
||||||
|
# Also install a convenience launcher in /usr/local/bin/ags
|
||||||
|
sudo mkdir -p /usr/local/bin
|
||||||
|
sudo tee /usr/local/bin/ags >/dev/null <<'EOF'
|
||||||
|
#!/usr/sbin/gjs -m
|
||||||
|
|
||||||
|
import { exit, programArgs, programInvocationName } from "system";
|
||||||
|
import GLib from "gi://GLib";
|
||||||
|
|
||||||
|
GLib.setenv("GI_TYPELIB_PATH", "/usr/local/lib:/usr/lib/girepository-1.0", true);
|
||||||
|
|
||||||
|
imports.package.init({
|
||||||
|
name: "com.github.Aylur.ags",
|
||||||
|
version: "1.9.0",
|
||||||
|
prefix: "/usr/local",
|
||||||
|
libdir: "/usr/local/lib",
|
||||||
|
});
|
||||||
|
|
||||||
|
const module = await import("resource:///com/github/Aylur/ags/main.js");
|
||||||
|
const exitCode = await module.main([programInvocationName, ...programArgs]);
|
||||||
|
exit(exitCode);
|
||||||
|
EOF
|
||||||
|
|
||||||
|
sudo chmod +x /usr/local/bin/ags
|
||||||
|
printf "${OK} AGS launcher installed.\n"
|
||||||
# Move logs to Install-Logs directory
|
# Move logs to Install-Logs directory
|
||||||
mv "$MLOG" ../Install-Logs/ || true
|
mv "$MLOG" ../Install-Logs/ || true
|
||||||
cd ..
|
cd ..
|
||||||
|
|||||||
Reference in New Issue
Block a user