|
|
|
@ -391,34 +391,36 @@ remove() {
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
# Show terminal user interface for better use
|
|
|
|
# Show terminal user interface for better use
|
|
|
|
if [[ $# -lt 1 ]] && [[ -x /usr/bin/dialog ]] ; then
|
|
|
|
if [[ $# -eq 0 ]]; then
|
|
|
|
install_dialog && run_dialog
|
|
|
|
if [[ ! -x /usr/bin/dialog ]]; then
|
|
|
|
fi
|
|
|
|
if [[ $UID -ne $ROOT_UID ]]; then
|
|
|
|
|
|
|
|
#Check if password is cached (if cache timestamp not expired yet)
|
|
|
|
if [[ $# -lt 1 ]] && [[ $UID -ne $ROOT_UID ]] && [[ ! -x /usr/bin/dialog ]] ; then
|
|
|
|
sudo -n true 2> /dev/null && echo
|
|
|
|
#Check if password is cached (if cache timestamp not expired yet)
|
|
|
|
|
|
|
|
sudo -n true 2> /dev/null && echo
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if [[ $? == 0 ]]; then
|
|
|
|
if [[ $? == 0 ]]; then
|
|
|
|
#No need to ask for password
|
|
|
|
#No need to ask for password
|
|
|
|
exec sudo $0
|
|
|
|
exec sudo $0
|
|
|
|
else
|
|
|
|
else
|
|
|
|
#Ask for password
|
|
|
|
#Ask for password
|
|
|
|
prompt -e "\n [ Error! ] -> Run me as root! "
|
|
|
|
prompt -e "\n [ Error! ] -> Run me as root! "
|
|
|
|
read -p " [ Trusted ] Specify the root password : " -t ${MAX_DELAY} -s
|
|
|
|
read -p " [ Trusted ] Specify the root password : " -t ${MAX_DELAY} -s
|
|
|
|
|
|
|
|
|
|
|
|
sudo -S echo <<< $REPLY 2> /dev/null && echo
|
|
|
|
sudo -S echo <<< $REPLY 2> /dev/null && echo
|
|
|
|
|
|
|
|
|
|
|
|
if [[ $? == 0 ]]; then
|
|
|
|
if [[ $? == 0 ]]; then
|
|
|
|
#Correct password, use with sudo's stdin
|
|
|
|
#Correct password, use with sudo's stdin
|
|
|
|
sudo $0 <<< $REPLY
|
|
|
|
sudo $0 <<< $REPLY
|
|
|
|
else
|
|
|
|
else
|
|
|
|
#block for 3 seconds before allowing another attempt
|
|
|
|
#block for 3 seconds before allowing another attempt
|
|
|
|
sleep 3
|
|
|
|
sleep 3
|
|
|
|
prompt -e "\n [ Error! ] -> Incorrect password!\n"
|
|
|
|
prompt -e "\n [ Error! ] -> Incorrect password!\n"
|
|
|
|
exit 1
|
|
|
|
exit 1
|
|
|
|
|
|
|
|
fi
|
|
|
|
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
|
|
|
|
install_dialog
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
|
|
|
|
run_dialog
|
|
|
|
fi
|
|
|
|
fi
|
|
|
|
|
|
|
|
|
|
|
|
while [[ $# -gt 0 ]]; do
|
|
|
|
while [[ $# -gt 0 ]]; do
|
|
|
|
|