["$nofail"="nofail"]||SUDO="fatal 'Can't find sudo. Please install and tune sudo ('# epm install sudo') or run epm under root.'"
["$nofail"="nofail"]||SUDO="fatal 'Can't find sudo. Please install and tune sudo ('# epm install sudo') or run epm under root.'"
return"$SUDO_TESTED"
return"$SUDO_TESTED"
fi
fi
# 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 passwordless 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 passwordless 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
SUDO_TESTED="0"
SUDO_TESTED="0"
# FIXME: does not work: sudo -- VARIABLE=some command
# FIXME: does not work: sudo -- VARIABLE=some command
SUDO="$SUDO_CMD"
SUDO="$SUDO_CMD"
#SUDO="$SUDO_CMD --"
#SUDO="$SUDO_CMD --"
# check for < 1.7 version which do not support -- (and --help possible too)
# check for < 1.7 version which do not support -- (and --help possible too)