commit 93d56bf65d82f0575d2a190379c3a5c1e8d92bb5
parent f88f1c8987d39cfc191881cf3f651d6ea79eff4f
Author: Alex Balgavy <a.balgavy@gmail.com>
Date: Mon, 27 May 2019 16:17:57 +0200
updatemaster: renew sudo privileges function
Former-commit-id: 9ba7e05efa5c607f60a490ac50b1c3bc46269fef
Diffstat:
1 file changed, 9 insertions(+), 0 deletions(-)
diff --git a/scripts/updatemaster b/scripts/updatemaster
@@ -25,6 +25,13 @@ hr() {
cols=$(tput cols)
printf '#%.0s' $(seq 1 "$cols")
}
+
+renew_sudo() {
+ if ! sudo --non-interactive 2> /dev/null; then
+ echo "Extend sudo timeout by giving your password now."
+ fi
+ sudo --validate
+}
# }}}
echo_progress "### STARTING UPDATE SCRIPT ###\n"
@@ -114,6 +121,7 @@ if command -v brew &> /dev/null; then
elif [ $select_casks = 1 ]; then
read -rp "Casks to upgrade (empty string cancels upgrade): " -a CASKS;
for i in ${CASKS[@]}; do
+ renew_sudo
if ! brew cask upgrade "$i"; then echo -e "Could not upgrade cask $i."; fi
done
else
@@ -125,6 +133,7 @@ if command -v brew &> /dev/null; then
echo
read -rp "Which casks would you like to upgrade? " -a CASKS;
for i in "${CASKS[@]}"; do
+ renew_sudo
if ! brew cask upgrade "$i"; then echo -e "Could not upgrade cask $i."; fi
done
;;