From 20094c5f752046a33287ef372fa973e919e83226 Mon Sep 17 00:00:00 2001 From: "Derek J. Clark" Date: Mon, 8 Aug 2022 11:32:14 -0700 Subject: Use Environment Variables (#123) 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 --- dist/install_release.sh | 23 ++++++++++++----------- 1 file changed, 12 insertions(+), 11 deletions(-) (limited to 'dist/install_release.sh') diff --git a/dist/install_release.sh b/dist/install_release.sh index cd690a8b..009997ad 100644 --- a/dist/install_release.sh +++ b/dist/install_release.sh @@ -4,33 +4,34 @@ echo "Installing Steam Deck Plugin Loader release..." -HOMEBREW_FOLDER=/home/deck/homebrew +USER_DIR="$(getent passwd $SUDO_USER | cut -d: -f6)" +HOMEBREW_FOLDER="${USER_DIR}/homebrew" # Create folder structure -rm -rf ${HOMEBREW_FOLDER}/services -sudo -u deck mkdir -p ${HOMEBREW_FOLDER}/services -sudo -u deck mkdir -p ${HOMEBREW_FOLDER}/plugins +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 -curl -L https://github.com/SteamDeckHomebrew/PluginLoader/releases/latest/download/PluginLoader --output ${HOMEBREW_FOLDER}/services/PluginLoader -chmod +x ${HOMEBREW_FOLDER}/services/PluginLoader +curl -L https://github.com/SteamDeckHomebrew/PluginLoader/releases/latest/download/PluginLoader --output "${HOMEBREW_FOLDER}/services/PluginLoader" +chmod +x "${HOMEBREW_FOLDER}/services/PluginLoader" 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 +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=/home/deck/homebrew/services/PluginLoader -WorkingDirectory=/home/deck/homebrew/services -Environment=PLUGIN_PATH=/home/deck/homebrew/plugins +ExecStart=${HOMEBREW_FOLDER}/services/PluginLoader +WorkingDirectory=${HOMEBREW_FOLDER}/services +Environment=PLUGIN_PATH=${HOMEBREW_FOLDER}/plugins [Install] WantedBy=multi-user.target EOM -- cgit v1.2.3