Browse Source

minor, fix _mktemp

neil 8 years ago
parent
commit
3aae1ae3d9
1 changed files with 11 additions and 3 deletions
  1. 11 3
      acme.sh

+ 11 - 3
acme.sh

@@ -722,11 +722,19 @@ _calcjwk() {
   _debug3 HEADER "$HEADER"
   _debug3 HEADER "$HEADER"
 }
 }
 
 
+_time() {
+  date -u "+%s"
+}
 
 
 _mktemp() {
 _mktemp() {
   if _exists mktemp ; then
   if _exists mktemp ; then
     mktemp
     mktemp
   fi
   fi
+  if [ -d "/tmp" ] ; then
+    echo "/tmp/${PROJECT_NAME}wefADf24sf.$(_time).tmp"
+    return 0
+  fi
+  _err "Can not create temp file."
 }
 }
 
 
 _inithttp() {
 _inithttp() {
@@ -1504,7 +1512,7 @@ issue() {
   if [ -f "$DOMAIN_CONF" ] ; then
   if [ -f "$DOMAIN_CONF" ] ; then
     Le_NextRenewTime=$(_readdomainconf Le_NextRenewTime)
     Le_NextRenewTime=$(_readdomainconf Le_NextRenewTime)
     _debug Le_NextRenewTime "$Le_NextRenewTime"
     _debug Le_NextRenewTime "$Le_NextRenewTime"
-    if [ -z "$FORCE" ] && [ "$Le_NextRenewTime" ] && [ $(date -u "+%s" ) -lt $Le_NextRenewTime ] ; then 
+    if [ -z "$FORCE" ] && [ "$Le_NextRenewTime" ] && [ $(_time) -lt $Le_NextRenewTime ] ; then 
       _info "Skip, Next renewal time is: $(__green "$(_readdomainconf Le_NextRenewTimeStr)")"
       _info "Skip, Next renewal time is: $(__green "$(_readdomainconf Le_NextRenewTimeStr)")"
       _info "Add '$(__red '--force')' to force to renew."    
       _info "Add '$(__red '--force')' to force to renew."    
       return $RENEW_SKIP
       return $RENEW_SKIP
@@ -2053,7 +2061,7 @@ issue() {
     _info "And the full chain certs is there: $( __green " $CERT_FULLCHAIN_PATH ")"
     _info "And the full chain certs is there: $( __green " $CERT_FULLCHAIN_PATH ")"
   fi
   fi
   
   
-  Le_CertCreateTime=$(date -u "+%s")
+  Le_CertCreateTime=$(_time)
   _savedomainconf  "Le_CertCreateTime"   "$Le_CertCreateTime"
   _savedomainconf  "Le_CertCreateTime"   "$Le_CertCreateTime"
   
   
   Le_CertCreateTimeStr=$(date -u )
   Le_CertCreateTimeStr=$(date -u )
@@ -2113,7 +2121,7 @@ renew() {
   fi
   fi
 
 
   . "$DOMAIN_CONF"
   . "$DOMAIN_CONF"
-  if [ -z "$FORCE" ] && [ "$Le_NextRenewTime" ] && [ "$(date -u "+%s" )" -lt "$Le_NextRenewTime" ] ; then 
+  if [ -z "$FORCE" ] && [ "$Le_NextRenewTime" ] && [ "$(_time)" -lt "$Le_NextRenewTime" ] ; then 
     _info "Skip, Next renewal time is: $(__green "$Le_NextRenewTimeStr")"
     _info "Skip, Next renewal time is: $(__green "$Le_NextRenewTimeStr")"
     _info "Add '$(__red '--force')' to force to renew."
     _info "Add '$(__red '--force')' to force to renew."
     return $RENEW_SKIP
     return $RENEW_SKIP