From a2fb7a7f2c9f91569568cfda674968487d52497f Mon Sep 17 00:00:00 2001 From: tranch Date: Thu, 10 Sep 2026 07:50:08 +0800 Subject: Add mirrored Decky ujust setup Provide an explicit setup-decky-mirror recipe that keeps upstream setup-decky intact while routing Decky Loader installer scripts through AeroCore's Decky mirror. Add a focused shell test to catch accidental fallbacks to the GitHub installer URL. --- .../ublue-os/just/92-aerocore-decky-mirror.just | 114 +++++++++++++++++++++ 1 file changed, 114 insertions(+) create mode 100644 system_files/usr/share/ublue-os/just/92-aerocore-decky-mirror.just (limited to 'system_files') diff --git a/system_files/usr/share/ublue-os/just/92-aerocore-decky-mirror.just b/system_files/usr/share/ublue-os/just/92-aerocore-decky-mirror.just new file mode 100644 index 0000000..b54bb94 --- /dev/null +++ b/system_files/usr/share/ublue-os/just/92-aerocore-decky-mirror.just @@ -0,0 +1,114 @@ +# vim: set ft=make : + +# Install and configure Decky Loader from the AeroCore mirror. Options: status | install | install-prerelease | uninstall +[group("gaming")] +setup-decky-mirror ACTION="": + #!/usr/bin/bash + set -euo pipefail + + if [[ $(id -u) -eq 0 ]]; then + echo >&2 "ERROR: Do not run this with sudo" + exit 1 + fi + + source /usr/lib/ujust/ujust.sh + + DECKY_MIRROR_HOST="${AEROCORE_DECKY_MIRROR_HOST:-decky.mirror.aerocore.com.cn}" + DECKY_INSTALLER_BASE="https://${DECKY_MIRROR_HOST}/SteamDeckHomebrew/decky-installer/releases/latest/download" + + get_status_token() { + local decky_service="/etc/systemd/system/plugin_loader.service" + if [[ ! -f /etc/systemd/system/multi-user.target.wants/plugin_loader.service ]]; then + echo "uninstall" + elif [[ -r "$decky_service" ]] && grep -q 'Environment=LOG_LEVEL=DEBUG' "$decky_service"; then + echo "install-prerelease" + elif [[ -r "$decky_service" ]]; then + echo "install" + else + return 1 + fi + } + + DECKY_STATE="${b}${red}Not Installed${n}" + case "$(get_status_token)" in + install) + DECKY_STATE="${b}${green}Installed${n}" + ;; + install-prerelease) + DECKY_STATE="${b}${yellow}Installed (Prerelease)${n}" + ;; + uninstall) + DECKY_STATE="${b}${red}Not Installed${n}" + ;; + esac + + setup_home_deck_compat() { + export HOME + HOME="$(getent passwd "${SUDO_USER:-$USER}" | cut -d: -f6)" + if [[ ! -L "/home/deck" && ! -e "/home/deck" && "$HOME" != "/home/deck" ]]; then + echo "Making a /home/deck symlink to fix plugins that do not use environment variables." + sudo -A ln -sf "$HOME" /home/deck + fi + } + + install_release() { + setup_home_deck_compat + curl -L "${DECKY_INSTALLER_BASE}/install_release.sh" | + sed 's|sudo|sudo -A |g' | sh + sudo -A chcon -R -t bin_t "$HOME/homebrew/services/PluginLoader" + } + + install_prerelease() { + setup_home_deck_compat + curl -L "${DECKY_INSTALLER_BASE}/install_prerelease.sh" | + sed 's|sudo|sudo -A |g' | sh + sudo -A chcon -R -t bin_t "$HOME/homebrew/services/PluginLoader" + } + + uninstall() { + echo "Uninstalling Decky Loader..." + curl -L "${DECKY_INSTALLER_BASE}/uninstall.sh" | + sed 's|sudo|sudo -A |g' | sh + echo "Decky Loader has been uninstalled." + } + + OPTION="{{ ACTION }}" + if [[ "$OPTION" == "help" ]]; then + echo "Usage: ujust setup-decky-mirror