From 6f0fffee078bd0e376346f742bff795362e36302 Mon Sep 17 00:00:00 2001 From: Mike Salvatore Date: Tue, 8 Dec 2020 10:01:36 -0500 Subject: [PATCH] Fix hung timeout when checking for sudo in deploy_linux.sh --- deployment_scripts/deploy_linux.sh | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/deployment_scripts/deploy_linux.sh b/deployment_scripts/deploy_linux.sh index 1f21fb758..cea8d70a8 100755 --- a/deployment_scripts/deploy_linux.sh +++ b/deployment_scripts/deploy_linux.sh @@ -10,7 +10,7 @@ is_root() { has_sudo() { # 0 true, 1 false - timeout 1 sudo id && return 0 || return 1 + return $(sudo -nv > /dev/null 2>&1) } handle_error() { @@ -67,8 +67,7 @@ ISLAND_BINARIES_PATH="$ISLAND_PATH/cc/binaries" INFECTION_MONKEY_DIR="$monkey_home/monkey/infection_monkey" MONKEY_BIN_DIR="$INFECTION_MONKEY_DIR/bin" -HAS_SUDO=$(has_sudo) -if [[ ! $HAS_SUDO ]]; then +if ! has_sudo; then log_message "You need root permissions for some of this script operations. Quiting." exit 1 fi