Browse Source

Added uninstall script

Toby Chui 2 years ago
parent
commit
54a976c5ca
2 changed files with 62 additions and 1 deletions
  1. 15 1
      installer/install.sh
  2. 47 0
      installer/uninstall.sh

+ 15 - 1
installer/installer.sh → installer/install.sh

@@ -1,5 +1,15 @@
 #!/bin/bash
-echo "----- ArozOS 2.0 Installer -----"
+cat << "EOF"
+    _               ___  ___   ___   __  
+   /_\  _ _ ___ ___/ _ \/ __| |_  ) /  \ 
+  / _ \| '_/ _ \_ / (_) \__ \  / / | () |
+ /_/ \_\_| \___/__|\___/|___/ /___(_)__/ 
+                                         
+	----- ArozOS 2.0 Installer -----	
+	
+EOF
+
+echo ""
 
 # Prompt the user to agree to the GPLv3 license
 read -p "Do you agree to the terms of the GPLv3 license? (y/n) " agree
@@ -148,7 +158,11 @@ EOF
         sudo systemctl enable arozos.service
 		sudo systemctl start arozos.service
         echo "ArozOS installation completed!"
+		ip_address=$(hostname -I | awk '{print $1}')
+		echo "Please continue the system setup at http://$ip_address:$arozport/"
     fi
 else
 	echo "ArozOS installation completed! Execute start.sh to startup your ArozOS system."
 fi
+
+

+ 47 - 0
installer/uninstall.sh

@@ -0,0 +1,47 @@
+#!/bin/bash
+cat << "EOF"
+    _               ___  ___   ___   __  
+   /_\  _ _ ___ ___/ _ \/ __| |_  ) /  \ 
+  / _ \| '_/ _ \_ / (_) \__ \  / / | () |
+ /_/ \_\_| \___/__|\___/|___/ /___(_)__/ 
+                                         
+	----- ArozOS 2.0 Uninstall -----	
+	
+EOF
+
+# Ask user to confirm uninstall
+read -p "Are you sure you want to uninstall Arozos? This will delete all data in the arozos directory. (y/n) " choice
+case "$choice" in
+  y|Y )
+	# Stop the ArozOS service if it is running
+	if [[ $(uname) == "Linux" ]]; then
+		if systemctl status arozos >/dev/null 2>&1; then
+			sudo systemctl stop arozos
+			echo "Stopped ArozOS service."
+		fi
+	fi
+
+	# Remove the ArozOS folder
+	cd ~/ || exit
+	if [[ -d "arozos" ]]; then
+		sudo rm -rf arozos
+		echo "Removed ArozOS folder."
+	fi
+
+	# Remove the ArozOS service file
+	if [[ $(uname) == "Linux" ]]; then
+		if [[ -f "/etc/systemd/system/arozos.service" ]]; then
+			sudo rm /etc/systemd/system/arozos.service
+			echo "Removed ArozOS systemd service file."
+		fi
+	fi
+	sudo systemctl daemon-reload
+	echo "ArozOS has been uninstalled successfully!"
+	;;
+  n|N ) 
+    echo "Uninstall cancelled"
+    ;;
+  * ) 
+    echo "Invalid input, uninstall cancelled"
+    ;;
+esac