From 6b90447b3092e7c2c93708e38cd65210f5c42a05 Mon Sep 17 00:00:00 2001 From: Peter Wood Date: Sun, 8 Jun 2025 20:06:18 -0400 Subject: [PATCH] fix: Improve sudo privilege check and provide user guidance for password prompts --- update.sh | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/update.sh b/update.sh index 8d85db9..d46f484 100755 --- a/update.sh +++ b/update.sh @@ -135,12 +135,14 @@ check_privileges() { return 0 fi - if ! sudo -n true 2>/dev/null; then - log_message "ERROR" "This script requires sudo privileges" - exit 4 + # Check if sudo is available, but don't require it upfront + if sudo -n true 2>/dev/null; then + debug_log "Sudo privileges confirmed and cached" + else + log_message "INFO" "Sudo credentials not cached - you may be prompted for password during updates" + log_message "INFO" "To avoid prompts, run: sudo -v before running this script" fi - debug_log "Sudo privileges confirmed" return 0 } @@ -239,7 +241,7 @@ detect_os() { log_message "INFO" "Detecting operating system..." if [[ -f /etc/os-release ]]; then - # shellcheck source=/etc/os-release + # shellcheck disable=SC1091 . /etc/os-release OS_NAME="$ID" OS_VERSION="$VERSION_ID"