From f16e72974c04023baa204c9aad6769419d27d010 Mon Sep 17 00:00:00 2001 From: bol-van Date: Sun, 27 Mar 2022 18:58:47 +0300 Subject: [PATCH] fix elevation issues and absence of /sbin in the PATH --- blockcheck.sh | 4 ++-- common/base.sh | 8 ++++++++ install_easy.sh | 1 + uninstall_easy.sh | 1 + 4 files changed, 12 insertions(+), 2 deletions(-) diff --git a/blockcheck.sh b/blockcheck.sh index e2f7801..082abcf 100755 --- a/blockcheck.sh +++ b/blockcheck.sh @@ -996,10 +996,10 @@ sigpipe() exit 1 } - +fix_sbin_path check_system -check_prerequisites require_root +check_prerequisites check_dns ask_params diff --git a/common/base.sh b/common/base.sh index 557de90..bba133a 100644 --- a/common/base.sh +++ b/common/base.sh @@ -174,3 +174,11 @@ call_for_multiple_items() done eval $2=\"$items\" } + +fix_sbin_path() +{ + local IFS=':' + printf "%s\n" $PATH | grep -Fxq '/usr/sbin' || PATH="/usr/sbin:$PATH" + printf "%s\n" $PATH | grep -Fxq '/sbin' || PATH="/sbin:$PATH" + export PATH +} diff --git a/install_easy.sh b/install_easy.sh index 7c6d79a..8fa9fc9 100755 --- a/install_easy.sh +++ b/install_easy.sh @@ -979,6 +979,7 @@ install_macos() # build binaries, do not use precompiled [ "$1" = "make" ] && FORCE_BUILD=1 +fix_sbin_path check_system [ "$SYSTEM" = "macos" ] && . "$EXEDIR/init.d/macos/functions" diff --git a/uninstall_easy.sh b/uninstall_easy.sh index 40e61a0..94f0e3b 100755 --- a/uninstall_easy.sh +++ b/uninstall_easy.sh @@ -73,6 +73,7 @@ remove_macos() } +fix_sbin_path check_system require_root