]> git.proxmox.com Git - mirror_acme.sh.git/commitdiff
check upgrade hash
authorneilpang <neil@neilpang.com>
Fri, 3 Jan 2020 13:38:47 +0000 (21:38 +0800)
committerneilpang <neil@neilpang.com>
Fri, 3 Jan 2020 13:38:47 +0000 (21:38 +0800)
https://github.com/Neilpang/acme.sh/issues/2667

acme.sh

diff --git a/acme.sh b/acme.sh
index fcebab7fc77c6fa54970fbc211b19ca4bc989c52..570e2836a4ebb51fe1e775cf35caefbd36ffca4e 100755 (executable)
--- a/acme.sh
+++ b/acme.sh
@@ -6303,6 +6303,7 @@ _installOnline() {
     chmod +x $PROJECT_ENTRY
     if ./$PROJECT_ENTRY install "$_nocron" "" "$_noprofile"; then
       _info "Install success!"
+      _saveaccountconf "UPGRADE_HASH" "$(_getMasterHash)"
     fi
 
     cd ..
@@ -6312,9 +6313,15 @@ _installOnline() {
   )
 }
 
+_getMasterHash() {
+  _hash_url="https://api.github.com/repos/Neilpang/acme.sh/git/refs/heads/master"
+  _get $_hash_url | tr -d "\r\n" | tr '{},' '\n' | grep '"sha":' | cut -d '"' -f 4
+}
+
 upgrade() {
   if (
     _initpath
+    [ -z "$FORCE" ] && [ "$(_getMasterHash)" = "$(_readaccountconf "UPGRADE_HASH")" ] && _info "Already uptodate!" && exit 0
     export LE_WORKING_DIR
     cd "$LE_WORKING_DIR"
     _installOnline "nocron" "noprofile"