zapret/common/elevate.sh

14 lines
266 B
Bash
Raw Normal View History

2022-02-15 14:15:36 +00:00
require_root()
{
local exe
echo \* checking privileges
[ $(id -u) -ne "0" ] && {
echo root is required
exe="$EXEDIR/$(basename "$0")"
exists sudo && exec sudo sh "$exe"
exists su && exec su root -c "sh \"$exe\""
2022-02-15 14:15:36 +00:00
echo su or sudo not found
exitp 2
}
}