Browse Source

fix compatible for pfsense.

neil 9 years ago
parent
commit
44df296707
1 changed files with 13 additions and 1 deletions
  1. 13 1
      le.sh

+ 13 - 1
le.sh

@@ -205,6 +205,18 @@ _time2str() {
   
   
 }
 }
 
 
+_stat() {
+  #Linux
+  if stat -c '%U:%G' "$1" 2>/dev/null ; then
+    return
+  fi
+  
+  #BSD
+  if stat -f  '%Su:%Sg' "$1" 2>/dev/null ; then
+    return
+  fi
+}
+
 _send_signed_request() {
 _send_signed_request() {
   url=$1
   url=$1
   payload=$2
   payload=$2
@@ -819,7 +831,7 @@ issue() {
         mkdir -p "$wellknown_path"
         mkdir -p "$wellknown_path"
         echo -n "$keyauthorization" > "$wellknown_path/$token"
         echo -n "$keyauthorization" > "$wellknown_path/$token"
 
 
-        webroot_owner=$(stat -c '%U:%G' $Le_Webroot)
+        webroot_owner=$(_stat $Le_Webroot)
         _debug "Changing owner/group of .well-known to $webroot_owner"
         _debug "Changing owner/group of .well-known to $webroot_owner"
         chown -R $webroot_owner "$Le_Webroot/.well-known"
         chown -R $webroot_owner "$Le_Webroot/.well-known"