summaryrefslogtreecommitdiff
path: root/dist/uninstall.sh
diff options
context:
space:
mode:
authorDerek J. Clark <derkejohn.clark@gmail.com>2022-08-08 11:32:14 -0700
committerGitHub <noreply@github.com>2022-08-08 11:32:14 -0700
commit20094c5f752046a33287ef372fa973e919e83226 (patch)
treeed298251be183fc5f3151b19a10f7499c7d66e0d /dist/uninstall.sh
parent198591dbd7b0b6dd311ab9265d4cda4a733ee280 (diff)
downloaddecky-loader-20094c5f752046a33287ef372fa973e919e83226.tar.gz
decky-loader-20094c5f752046a33287ef372fa973e919e83226.zip
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
Diffstat (limited to 'dist/uninstall.sh')
-rw-r--r--dist/uninstall.sh13
1 files changed, 8 insertions, 5 deletions
diff --git a/dist/uninstall.sh b/dist/uninstall.sh
index a98ba0de..0680338d 100644
--- a/dist/uninstall.sh
+++ b/dist/uninstall.sh
@@ -1,17 +1,20 @@
#!/bin/sh
+[ "$UID" -eq 0 ] || exec sudo "$0" "$@"
+
echo "Uninstalling Steam Deck Plugin Loader..."
-HOMEBREW_FOLDER=/home/deck/homebrew
+USER_DIR="$(getent passwd $SUDO_USER | cut -d: -f6)"
+HOMEBREW_FOLDER="${USER_DIR}/homebrew"
# Disable and remove services
sudo systemctl disable --now plugin_loader.service > /dev/null
-sudo rm -f /home/deck/.config/systemd/user/plugin_loader.service
-sudo rm -f /etc/systemd/system/plugin_loader.service
+sudo rm -f "${USER_DIR}/.config/systemd/user/plugin_loader.service"
+sudo rm -f "/etc/systemd/system/plugin_loader.service"
# Remove temporary folder if it exists from the install process
-rm -rf /tmp/plugin_loader
+rm -rf "/tmp/plugin_loader"
# Cleanup services folder
-sudo rm ${HOMEBREW_FOLDER}/services/PluginLoader
+sudo rm "${HOMEBREW_FOLDER}/services/PluginLoader"