fix: smart sudo
This commit is contained in:
parent
0cd1c2011b
commit
daa0507b47
1 changed files with 2 additions and 1 deletions
3
dot
3
dot
|
@ -19,7 +19,8 @@ include() {
|
||||||
func() {
|
func() {
|
||||||
if is_function $(echo "super_$2"); then
|
if is_function $(echo "super_$2"); then
|
||||||
[ "${DO_SUDO:-yes}" = "yes" ] || return 0
|
[ "${DO_SUDO:-yes}" = "yes" ] || return 0
|
||||||
sudo sh -c ". $1 && super_$2"
|
cmd="sh -c \". $1 && super_$2\""
|
||||||
|
[ "$(id -u)" = "0" ] && $cmd || sudo $cmd
|
||||||
fi
|
fi
|
||||||
is_function $2 && $2
|
is_function $2 && $2
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue