Browse Source
Merge pull request #2798 from oliverblaha/dev
add support for upgrade from tag
pull/2807/head
neil
5 years ago
committed by
GitHub
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with
13 additions and
5 deletions
-
acme.sh
|
@ -6317,7 +6317,7 @@ _installOnline() { |
|
|
if ./$PROJECT_ENTRY install "$_nocron" "" "$_noprofile"; then |
|
|
if ./$PROJECT_ENTRY install "$_nocron" "" "$_noprofile"; then |
|
|
_info "Install success!" |
|
|
_info "Install success!" |
|
|
_initpath |
|
|
_initpath |
|
|
_saveaccountconf "UPGRADE_HASH" "$(_getMasterHash)" |
|
|
|
|
|
|
|
|
_saveaccountconf "UPGRADE_HASH" "$(_getUpgradeHash)" |
|
|
fi |
|
|
fi |
|
|
|
|
|
|
|
|
cd .. |
|
|
cd .. |
|
@ -6327,19 +6327,27 @@ _installOnline() { |
|
|
) |
|
|
) |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
_getMasterHash() { |
|
|
|
|
|
|
|
|
_getRepoHash() { |
|
|
|
|
|
_hash_path=$1 |
|
|
|
|
|
shift |
|
|
|
|
|
_hash_url="https://api.github.com/repos/acmesh-official/$PROJECT_NAME/git/refs/$_hash_path" |
|
|
|
|
|
_get $_hash_url | tr -d "\r\n" | tr '{},' '\n' | grep '"sha":' | cut -d '"' -f 4 |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
_getUpgradeHash() { |
|
|
_b="$BRANCH" |
|
|
_b="$BRANCH" |
|
|
if [ -z "$_b" ]; then |
|
|
if [ -z "$_b" ]; then |
|
|
_b="master" |
|
|
_b="master" |
|
|
fi |
|
|
fi |
|
|
_hash_url="https://api.github.com/repos/acmesh-official/$PROJECT_NAME/git/refs/heads/$_b" |
|
|
|
|
|
_get $_hash_url | tr -d "\r\n" | tr '{},' '\n' | grep '"sha":' | cut -d '"' -f 4 |
|
|
|
|
|
|
|
|
_hash=$(_getRepoHash "heads/$_b") |
|
|
|
|
|
if [ -z "$_hash" ]; then _hash=$(_getRepoHash "tags/$_b"); fi |
|
|
|
|
|
echo $_hash |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
upgrade() { |
|
|
upgrade() { |
|
|
if ( |
|
|
if ( |
|
|
_initpath |
|
|
_initpath |
|
|
[ -z "$FORCE" ] && [ "$(_getMasterHash)" = "$(_readaccountconf "UPGRADE_HASH")" ] && _info "Already uptodate!" && exit 0 |
|
|
|
|
|
|
|
|
[ -z "$FORCE" ] && [ "$(_getUpgradeHash)" = "$(_readaccountconf "UPGRADE_HASH")" ] && _info "Already uptodate!" && exit 0 |
|
|
export LE_WORKING_DIR |
|
|
export LE_WORKING_DIR |
|
|
cd "$LE_WORKING_DIR" |
|
|
cd "$LE_WORKING_DIR" |
|
|
_installOnline "nocron" "noprofile" |
|
|
_installOnline "nocron" "noprofile" |
|
|