Commit 557a796a authored by Vitaly Lipatov's avatar Vitaly Lipatov

epm-sh-functions: add sudo_allowed

parent f257ae5e
...@@ -360,13 +360,13 @@ set_sudo() ...@@ -360,13 +360,13 @@ set_sudo()
# if input is a console # if input is a console
if inputisatty && isatty && isatty2 ; then if inputisatty && isatty && isatty2 ; then
if ! $SUDO_CMD -l >/dev/null ; then if ! $SUDO_CMD -l >/dev/null ; then
[ "$nofail" = "nofail" ] || SUDO="fatal 'Can't use sudo (only without password sudo is supported in non interactive using). Please run epm under root.'" [ "$nofail" = "nofail" ] || SUDO="fatal 'Can't use sudo (only passwordless sudo is supported in non interactive using). Please run epm under root.'"
return "$SUDO_TESTED" return "$SUDO_TESTED"
fi fi
else else
# use sudo if one is tuned and tuned without password # use sudo if one is tuned and tuned without password
if ! $SUDO_CMD -l -n >/dev/null 2>/dev/null ; then if ! $SUDO_CMD -l -n >/dev/null 2>/dev/null ; then
[ "$nofail" = "nofail" ] || SUDO="fatal 'Can't use sudo (only without password sudo is supported). Please run epm under root or check http://altlinux.org/sudo.'" [ "$nofail" = "nofail" ] || SUDO="fatal 'Can't use sudo (only passwordless sudo is supported). Please run epm under root or check http://altlinux.org/sudo.'"
return "$SUDO_TESTED" return "$SUDO_TESTED"
fi fi
fi fi
...@@ -378,6 +378,12 @@ set_sudo() ...@@ -378,6 +378,12 @@ set_sudo()
} }
# return TRUE if we can run privileged command
sudo_allowed()
{
set_sudo nofail
}
# wait for n seconds (if possible) during executing command # wait for n seconds (if possible) during executing command
# args: seconds command # args: seconds command
withtimeout() withtimeout()
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment