File tree Expand file tree Collapse file tree 1 file changed +22
-1
lines changed
Expand file tree Collapse file tree 1 file changed +22
-1
lines changed Original file line number Diff line number Diff line change @@ -64,9 +64,21 @@ wrn_lvl=3
6464inf_lvl=4
6565dbg_lvl=5
6666
67+ # Trap Control-C
68+ stty -echoctl # hide ^C
69+ trap ' other_commands' SIGINT
70+
6771# #######################################################################
6872# ### Functions:
6973# #######################################################################
74+ function other_commands()
75+ {
76+ tput setaf 1
77+ printf " You can 'not' exit this script by pressing Control-C..."
78+ tput sgr0
79+ printf " Continue with last 'asked' input..."
80+ }
81+
7082function CheckRoot()
7183{
7284 clear;
@@ -76,7 +88,16 @@ function CheckRoot()
7688 echo -e " $redback Do not run this script with sudo or as root$resetvid "
7789 exit
7890 else
79- sudo echo " Running Script: ${sname} $version "
91+ echo -e " This script needs some parts of it to run with elevated permissions."
92+ echo -e " Please enter your password for that to happen."
93+ sudo -k # revoke previously cached sudo password
94+ if sudo true
95+ then
96+ echo " Running Script: ${sname} $version "
97+ else
98+ echo " Password was incorrect for sudo elevated rights. Exiting Script."
99+ exit 1
100+ fi
80101 fi
81102}
82103
You can’t perform that action at this time.
0 commit comments