fixed purge script logic

This commit is contained in:
Will Russell
2023-09-26 11:49:12 -04:00
parent 01104333e6
commit 599e0c477d

View File

@@ -1,11 +1,6 @@
#!/bin/bash
echo "use with caution, this script will make changes in a broad-strokes kind of way. Use only if absolutely necessary"
echo "This script is going to ask if you're sure, only proceed (by pressing enter) if you've read through what this script does"
echo "note also that this script requires sudo to succeed, and will fail if you've run this without adequate permissions"
echo "commands that are going to be run are: 'apt purge nvidia-*' 'apt autoremove' 'dpkg -l | grep nvidia' 'apt-get --purge remove <dpkg-name>'"
echo "press enter to proceed, otherwise press ctrl+c to abort"
read go_opt
echo "proceeding with script; Would you like to allow the script to attempt to [a]utomatically remove elements (a|A) or would you prefer to [s]elect what to remove? (S|s)"
remove(){
case $option in
a|A) clear
echo "proceeding with cleanup"
@@ -18,7 +13,7 @@ case $option in
echo "if you intend to boot to CLI only for additional debugging, run: $ sudo systemctl set-default multi-user.target"
exit 0
;;
s|S|) clear
s|S) clear
echo "Proceeding with manual removal option, please confirm y/n at all prompts to clean up"
echo "commands that are going to be run are: 'apt purge nvidia-*' 'apt autoremove' 'dpkg -l | grep nvidia' 'apt-get --purge remove <dpkg-name>'"
echo "if you abort mid-stream for any reason, you can run the above manually instead to finish up cleanup"
@@ -36,8 +31,19 @@ case $option in
exit 1
;;
esac
}
echo "use with caution, this script will make changes in a broad-strokes kind of way. Use only if absolutely necessary"
echo "This script is going to ask if you're sure, only proceed (by pressing enter) if you've read through what this script does"
echo "note also that this script requires sudo to succeed, and will fail if you've run this without adequate permissions"
echo "commands that are going to be run are: 'apt purge nvidia-*' 'apt autoremove' 'dpkg -l | grep nvidia' 'apt-get --purge remove <dpkg-name>'"
echo "press enter to proceed, otherwise press ctrl+c to abort"
read placeholder
echo "proceeding with script; Would you like to allow the script to attempt to [a]utomatically remove elements (a|A) or would you prefer to [s]elect what to remove? (S|s)"
read option
remove
echo "cleanup completed, please ensure you re-install a graphics driver next BEFORE rebooting"
exit 0
exit 0