mirror of
https://github.com/limosek/zaf.git
synced 2024-11-21 18:09:06 +01:00
Missed zaf_which
This commit is contained in:
parent
f72488708b
commit
b80fd5ce7f
11
install.sh
11
install.sh
@ -16,6 +16,17 @@ zaf_fetch_url(){
|
|||||||
curl -f -k -s -L -o - "$1"
|
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
|
# Lite version of zaf_err, full version will be loaded later
|
||||||
zaf_err() {
|
zaf_err() {
|
||||||
logger ${ZAF_LOG_STDERR} -p user.err -t zaf-error -- $@
|
logger ${ZAF_LOG_STDERR} -p user.err -t zaf-error -- $@
|
||||||
|
@ -266,7 +266,7 @@ zaf_random() {
|
|||||||
|
|
||||||
# Emulate sudo
|
# Emulate sudo
|
||||||
zaf_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
|
else
|
||||||
sudo $@
|
sudo $@
|
||||||
|
Loading…
Reference in New Issue
Block a user