1
0
mirror of https://github.com/limosek/zaf.git synced 2024-11-13 05:59:06 +01:00

Missed zaf_which

This commit is contained in:
Lukas Macura 2016-11-21 17:05:13 +01:00
parent f72488708b
commit b80fd5ce7f
2 changed files with 12 additions and 1 deletions

View File

@ -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 -- $@

View File

@ -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 $@