Browse Source

minor
#check if there is sudo installed, AND if the current user is a sudoer.

neil 9 years ago
parent
commit
b3a2aac829
1 changed files with 8 additions and 1 deletions
  1. 8 1
      le.sh

+ 8 - 1
le.sh

@@ -260,7 +260,14 @@ _stopserver() {
 }
 }
 
 
 _initpath() {
 _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 "$API" ] ; then
     if [ -z "$STAGE" ] ; then
     if [ -z "$STAGE" ] ; then
       API="$DEFAULT_CA"
       API="$DEFAULT_CA"