-
-
Notifications
You must be signed in to change notification settings - Fork 21
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
76 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,56 @@ | ||
#!/usr/bin/env bash | ||
|
||
for_install=0 | ||
if [[ -n "$1" ]] && [[ "$1" == "--for-install" ]]; then | ||
for_install=1 | ||
fi | ||
|
||
# we don't want the uninstall script to be able to cause a failure if being triggered by the setup script | ||
[ "$for_install" -eq 0 ] && set -e | ||
|
||
# Make sure only root can run our script | ||
if [ "$(id -u)" != "0" ]; then | ||
echo "This script must be run as root" 1>&2 | ||
exit 1 | ||
fi | ||
|
||
# If we're on Steam Deck, check if the file system is readonly, if so, disable readonly and store the state to re-enable later | ||
steam_deck_readonly_fs=0 | ||
if [ "$for_install" -eq 0 ] && [ $(command -v steamos-readonly) ]; then | ||
if steamos-readonly status | grep -q "enabled"; then | ||
steam_deck_readonly_fs=1 | ||
echo "Disabling readonly SteamOS partition" | ||
steamos-readonly disable | ||
fi | ||
fi | ||
|
||
[ "$for_install" -eq 0 ] && echo "Removing the udev rule" | ||
rm -f /etc/udev/rules.d/60-xreal-air.rules | ||
udevadm control --reload | ||
|
||
[ "$for_install" -eq 0 ] && echo "Removing the systemd service" | ||
if systemctl is-active --quiet xreal-air-driver; then | ||
systemctl stop xreal-air-driver | ||
fi | ||
rm -f /etc/systemd/system/xreal-air-driver.service | ||
rm -f /usr/bin/xrealAirLinuxDriver | ||
|
||
# If we disabled the Steam Deck readonly file system, re-enable it | ||
if [ "$steam_deck_readonly_fs" -eq 1 ]; then | ||
echo "Re-enabling readonly SteamOS partition" | ||
steamos-readonly enable | ||
fi | ||
|
||
[ "$for_install" -eq 0 ] && echo "Removing installed files from ~/ and ~/bin/" | ||
USER=${SUDO_USER:-$USER} | ||
USER_HOME=$(getent passwd $USER | cut -d: -f6) | ||
if [ "$for_install" -eq 0 ]; then | ||
rm -f $USER_HOME/.xreal_driver_config | ||
rm -f $USER_HOME/.xreal_driver_log | ||
fi | ||
rm -f $USER_HOME/.xreal_joystick_debug | ||
rm -f $USER_HOME/.xreal_driver_lock | ||
rm -f $USER_HOME/bin/xreal_driver_config | ||
|
||
# this script is self-deleting, leave this as the last command | ||
rm -f $USER_HOME/bin/xreal_driver_uninstall |