fix: smart sudo

This commit is contained in:
Strix 2023-11-19 01:10:55 +01:00
parent 0cd1c2011b
commit daa0507b47
No known key found for this signature in database
GPG key ID: 5F35B3B8537287A7

3
dot
View file

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