From b3a2aac82903f73e052a59964e69c5ad5522df64 Mon Sep 17 00:00:00 2001 From: neil Date: Wed, 27 Jan 2016 13:15:12 +0800 Subject: [PATCH] minor #check if there is sudo installed, AND if the current user is a sudoer. --- le.sh | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/le.sh b/le.sh index 3661868..fe2c30c 100755 --- a/le.sh +++ b/le.sh @@ -260,7 +260,14 @@ _stopserver() { } _initpath() { - SUDO="$(command -v sudo | grep -o 'sudo')" + + #check if there is sudo installed, AND if the current user is a sudoer. + if command -v sudo > /dev/null ; then + if [ "$(sudo -n uptime 2>&1|grep "load"|wc -l)" != "0" ] ; then + SUDO=sudo + fi + fi + if [ -z "$API" ] ; then if [ -z "$STAGE" ] ; then API="$DEFAULT_CA"