From 599e0c477d5b4536b3aedbb754ac0fea85a84c89 Mon Sep 17 00:00:00 2001 From: Will Russell Date: Tue, 26 Sep 2023 11:49:12 -0400 Subject: [PATCH] fixed purge script logic --- purge_nvidia.sh | 30 ++++++++++++++++++------------ 1 file changed, 18 insertions(+), 12 deletions(-) diff --git a/purge_nvidia.sh b/purge_nvidia.sh index d36de20..0304a75 100755 --- a/purge_nvidia.sh +++ b/purge_nvidia.sh @@ -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 '" -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 '" 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 '" +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 \ No newline at end of file