mirror of
https://github.com/SteamDeckHomebrew/decky-loader.git
synced 2026-06-11 08:03:26 +03:00
Uses environment variables instead of hard coding the "deck" user/group. This adds support for systems other than the steam deck that are using the DeckUI. * Use Environment Variables * Use method to get USER from a systemd root process * Fix imports. Add get_user and get_user_group methods in helpers.py. Removed duplicated code * Add separate setters/getters for user vars. Ensure sleep prevents race condition of user setter in while loop
47 lines
1.5 KiB
Bash
47 lines
1.5 KiB
Bash
#!/bin/sh
|
|
|
|
[ "$UID" -eq 0 ] || exec sudo "$0" "$@"
|
|
|
|
echo "Installing Steam Deck Plugin Loader pre-release..."
|
|
|
|
USER_DIR="$(getent passwd $SUDO_USER | cut -d: -f6)"
|
|
HOMEBREW_FOLDER="${USER_DIR}/homebrew"
|
|
|
|
# # Create folder structure
|
|
rm -rf ${HOMEBREW_FOLDER}/services
|
|
sudo -u $SUDO_USER mkdir -p "${HOMEBREW_FOLDER}/services"
|
|
sudo -u $SUDO_USER mkdir -p "${HOMEBREW_FOLDER}/plugins"
|
|
|
|
# Download latest release and install it
|
|
RELEASE=$(curl -s 'https://api.github.com/repos/SteamDeckHomebrew/decky-loader/releases' | jq -r "first(.[] | select(.prerelease == "true"))")
|
|
read VERSION DOWNLOADURL < <(echo $(jq -r '.tag_name, .assets[].browser_download_url' <<< ${RELEASE}))
|
|
|
|
printf "Installing version %s...\n" "${VERSION}"
|
|
curl -L $DOWNLOADURL --output ${HOMEBREW_FOLDER}/services/PluginLoader
|
|
chmod +x ${HOMEBREW_FOLDER}/services/PluginLoader
|
|
echo $VERSION > ${HOMEBREW_FOLDER}/services/.loader.version
|
|
|
|
systemctl --user stop plugin_loader 2> /dev/null
|
|
systemctl --user disable plugin_loader 2> /dev/null
|
|
|
|
systemctl stop plugin_loader 2> /dev/null
|
|
systemctl disable plugin_loader 2> /dev/null
|
|
rm -f /etc/systemd/system/plugin_loader.service
|
|
cat > /etc/systemd/system/plugin_loader.service <<- EOM
|
|
[Unit]
|
|
Description=SteamDeck Plugin Loader
|
|
[Service]
|
|
Type=simple
|
|
User=root
|
|
Restart=always
|
|
ExecStart=${HOMEBREW_FOLDER}/services/PluginLoader
|
|
WorkingDirectory=${HOMEBREW_FOLDER}/services
|
|
Environment=PLUGIN_PATH=${HOMEBREW_FOLDER}/plugins
|
|
Environment=LOG_LEVEL=DEBUG
|
|
[Install]
|
|
WantedBy=multi-user.target
|
|
EOM
|
|
systemctl daemon-reload
|
|
systemctl start plugin_loader
|
|
systemctl enable plugin_loader
|