diff --git a/install.sh b/install.sh index 86f5943..348dd84 100755 --- a/install.sh +++ b/install.sh @@ -16,6 +16,17 @@ zaf_fetch_url(){ curl -f -k -s -L -o - "$1" } +# Lite version of zaf_which, full version will be loaded later +zaf_which() { + if which >/dev/null 2>/dev/null; then + which "$1" + else + [ -x /bin/$1 ] && { echo /bin/$1; return; } + [ -x /usr/bin/$1 ] && { echo /usr/bin/$1; return; } + return 1 + fi +} + # Lite version of zaf_err, full version will be loaded later zaf_err() { logger ${ZAF_LOG_STDERR} -p user.err -t zaf-error -- $@ diff --git a/lib/zaf.lib.sh b/lib/zaf.lib.sh index c6f13d6..58d4749 100644 --- a/lib/zaf.lib.sh +++ b/lib/zaf.lib.sh @@ -266,7 +266,7 @@ zaf_random() { # Emulate sudo zaf_sudo() { - if zaf_is_root || ! which sudo >/dev/null 2>/dev/null; then + if zaf_is_root || ! zaf_which sudo >/dev/null 2>/dev/null; then $@ else sudo $@