Commit 5245c1eb authored by Vitaly Lipatov's avatar Vitaly Lipatov

rewrite set_sudo, skip SUDO if env. var EPMNOSUDO is not empty

parent 7b909986
...@@ -127,14 +127,20 @@ fatal() ...@@ -127,14 +127,20 @@ fatal()
set_sudo() set_sudo()
{ {
SUDO=""
# skip SUDO if disabled
[ -n "$EPMNOSUDO" ] && return
# set SUDO not for root user # set SUDO not for root user
[ -n "$UID" ] || UID=`id -u` [ -n "$UID" ] || UID=`id -u`
if [ $UID = "0" ]; then
SUDO="" # do not need sudo
else [ $UID = "0" ] && return
SUDO="fatal 'Can't find sudo. Please install sudo or run epm under root.'"
which sudo >/dev/null 2>/dev/null && SUDO="sudo" # use sudo if possible
fi which sudo >/dev/null 2>/dev/null && SUDO="sudo" && return
SUDO="fatal 'Can't find sudo. Please install sudo or run epm under root.'"
} }
# print options description from HELPCMD/HELPOPT lines in the code # print options description from HELPCMD/HELPOPT lines in the code
......
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