Last active
February 7, 2026 18:23
-
-
Save loriopatrick/c18c4b6dd621c13a3c0d1cb48519b491 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
| #!/bin/bash | |
| # Playit.gg uninstall script for Linux (x86 and arm) | |
| # This script removes playit.gg and undoes all changes made by the setup script, | |
| # including the systemd service, screen session, apt package/PPA, and binary files. | |
| service_file="/etc/systemd/system/playit.service" | |
| binary_path="" | |
| # Parse the binary path from the service file before we remove it | |
| if [ -f "$service_file" ] | |
| then | |
| # Extract the full binary path from the ExecStart line | |
| # The format is: ExecStart=/usr/bin/screen -d -m -S playit.gg /path/to/binary | |
| binary_path=$( sudo grep -Po '(?<=playit\.gg ).+$' "$service_file" ) | |
| fi | |
| # Check if playit was installed via apt | |
| apt_installed=false | |
| if dpkg -s playit &> /dev/null | |
| then | |
| apt_installed=true | |
| fi | |
| printf "\n\033[04========m\033[01mplayit.gg Uninstaller\033[00m\033[04========\033[00m\n\n" | |
| if [ "$apt_installed" = true ] | |
| then | |
| printf "Detected playit installed via \033[01mapt\033[00m (Debian/Ubuntu)\n" | |
| else | |
| if [ -n "$binary_path" ] | |
| then | |
| printf "Detected playit installed via \033[01mmanual binary download\033[00m\n" | |
| printf "Binary location: \033[01m$binary_path\033[00m\n" | |
| else | |
| printf "No playit installation detected (no service file or apt package found)\n" | |
| exit 1 | |
| fi | |
| fi | |
| printf "\nThis will remove playit.gg and all associated files from your system.\n" | |
| printf "Are you sure you want to continue? (yes/no): " | |
| read confirm | |
| if [ "$confirm" != "yes" ] | |
| then | |
| printf "Uninstall cancelled.\n" | |
| exit 0 | |
| fi | |
| # Step 1: Stop and remove the systemd service | |
| printf "\n\033[04=====m\033[01mStopping and removing systemd service\033[00m\033[04=====\033[00m\n" | |
| if [ -f "$service_file" ] | |
| then | |
| printf "Stopping playit service...\n" | |
| sudo systemctl stop playit 2>/dev/null | |
| printf "Disabling playit service...\n" | |
| sudo systemctl disable playit 2>/dev/null | |
| printf "Removing service file...\n" | |
| sudo rm "$service_file" | |
| printf "Reloading systemctl...\n" | |
| sudo systemctl daemon-reload | |
| printf "Service removed successfully\n" | |
| else | |
| printf "No service file found, skipping...\n" | |
| fi | |
| # Step 2: Kill the screen session | |
| printf "\n\033[04=====m\033[01mTerminating screen session\033[00m\033[04=====\033[00m\n" | |
| if screen -list | grep -q "playit.gg" 2>/dev/null | |
| then | |
| printf "Terminating playit.gg screen session...\n" | |
| screen -S playit.gg -X quit | |
| printf "Screen session terminated\n" | |
| else | |
| printf "No playit.gg screen session found, skipping...\n" | |
| fi | |
| # Step 3: Remove playit binary/package | |
| if [ "$apt_installed" = true ] | |
| then | |
| # Debian/Ubuntu: remove package and PPA | |
| printf "\n\033[04=====m\033[01mRemoving playit apt package\033[00m\033[04=====\033[00m\n" | |
| sudo apt remove --purge -y playit | |
| printf "\n\033[04=====m\033[01mRemoving playit PPA\033[00m\033[04=====\033[00m\n" | |
| if [ -f /etc/apt/sources.list.d/playit-cloud.list ] | |
| then | |
| printf "Removing sources list...\n" | |
| sudo rm /etc/apt/sources.list.d/playit-cloud.list | |
| else | |
| printf "No sources list found, skipping...\n" | |
| fi | |
| # Remove the GPG key | |
| printf "Removing GPG key...\n" | |
| # Find and remove the playit-cloud key from apt-key | |
| key_id=$( sudo apt-key list 2>/dev/null | grep -B 1 "playit" | head -n 1 | tr -d ' ' ) | |
| if [ -n "$key_id" ] | |
| then | |
| sudo apt-key del "$key_id" 2>/dev/null | |
| printf "GPG key removed\n" | |
| else | |
| printf "No GPG key found, skipping...\n" | |
| fi | |
| printf "\nUpdating apt...\n" | |
| sudo apt update | |
| else | |
| # Non-Debian: remove the downloaded binary | |
| printf "\n\033[04=====m\033[01mRemoving playit binary\033[00m\033[04=====\033[00m\n" | |
| if [ -n "$binary_path" ] && [ -f "$binary_path" ] | |
| then | |
| printf "Removing $binary_path...\n" | |
| rm "$binary_path" | |
| printf "Binary removed\n" | |
| else | |
| printf "Binary not found at expected path, skipping...\n" | |
| fi | |
| fi | |
| printf "\n\033[04========m\033[01mUninstall complete\033[00m\033[04========\033[00m\n" | |
| printf "playit.gg has been removed from your system.\n\n" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment