From 32fdc196977662704eba6197c5f14dde32990180 Mon Sep 17 00:00:00 2001 From: Tim O'Brien Date: Fri, 22 Jul 2016 14:17:33 -0700 Subject: [PATCH] Support for shells without 'stat' (busybox ash) - the _stat command can now return an error - the issue() command chown command isn't run if _stat fails --- acme.sh | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/acme.sh b/acme.sh index 2c6e480a..bcd0e78f 100755 --- a/acme.sh +++ b/acme.sh @@ -549,6 +549,7 @@ _stat() { if stat -f '%Su:%Sg' "$1" 2>/dev/null ; then return fi + return 3; #error, 'stat' not found } #keyfile @@ -1656,9 +1657,12 @@ issue() { mkdir -p "$wellknown_path" printf "%s" "$keyauthorization" > "$wellknown_path/$token" if [ ! "$usingApache" ] ; then - webroot_owner=$(_stat $_currentRoot) - _debug "Changing owner/group of .well-known to $webroot_owner" - chown -R $webroot_owner "$_currentRoot/.well-known" + if webroot_owner=$(_stat $_currentRoot) ; then + _debug "Changing owner/group of .well-known to $webroot_owner" + chown -R $webroot_owner "$_currentRoot/.well-known" + else + _debug "not chaning owner/group of webroot"; + fi fi fi