2.2.9 support --upgrade

This commit is contained in:
neil 2016-06-26 13:30:47 +08:00
parent e4a1958573
commit 52677b0a88
1 changed files with 28 additions and 4 deletions

32
acme.sh
View File

@ -1,6 +1,6 @@
#!/usr/bin/env sh #!/usr/bin/env sh
VER=2.2.8 VER=2.2.9
PROJECT_NAME="acme.sh" PROJECT_NAME="acme.sh"
@ -2272,7 +2272,10 @@ install() {
_err "Install failed." _err "Install failed."
return 1 return 1
fi fi
if [ "$_nocron" ] ; then
_debug "Skip install cron job"
fi
if ! _precheck "$_nocron" ; then if ! _precheck "$_nocron" ; then
_err "Pre-check failed, can not install." _err "Pre-check failed, can not install."
return 1 return 1
@ -2357,8 +2360,12 @@ install() {
_info OK _info OK
} }
# nocron
uninstall() { uninstall() {
uninstallcronjob _nocron="$1"
if [ -z "$_nocron" ] ; then
uninstallcronjob
fi
_initpath _initpath
_profile="$(_detect_profile)" _profile="$(_detect_profile)"
@ -2405,6 +2412,7 @@ Commands:
--version, -v Show version info. --version, -v Show version info.
--install Install $PROJECT_NAME to your system. --install Install $PROJECT_NAME to your system.
--uninstall Uninstall $PROJECT_NAME, and uninstall the cron job. --uninstall Uninstall $PROJECT_NAME, and uninstall the cron job.
--upgrade Upgrade $PROJECT_NAME to the latest code from $PROJECT
--issue Issue a cert. --issue Issue a cert.
--installcert Install the issued cert to apache/nginx or any other server. --installcert Install the issued cert to apache/nginx or any other server.
--renew, -r Renew a cert. --renew, -r Renew a cert.
@ -2460,8 +2468,10 @@ Parameters:
" "
} }
# nocron
_installOnline() { _installOnline() {
_info "Installing from online archive." _info "Installing from online archive."
_nocron="$1"
if [ ! "$BRANCH" ] ; then if [ ! "$BRANCH" ] ; then
BRANCH="master" BRANCH="master"
fi fi
@ -2477,7 +2487,7 @@ _installOnline() {
tar xzf $localname tar xzf $localname
cd "$PROJECT_NAME-$BRANCH" cd "$PROJECT_NAME-$BRANCH"
chmod +x $PROJECT_ENTRY chmod +x $PROJECT_ENTRY
if ./$PROJECT_ENTRY install ; then if ./$PROJECT_ENTRY install "$_nocron" ; then
_info "Install success!" _info "Install success!"
fi fi
@ -2486,6 +2496,16 @@ _installOnline() {
rm -f "$localname" rm -f "$localname"
} }
upgrade() {
if (
cd $LE_WORKING_DIR
_installOnline "nocron"
) ; then
_info "Upgrade success!"
else
_err "Upgrade failed!"
fi
}
_process() { _process() {
_CMD="" _CMD=""
@ -2529,6 +2549,9 @@ _process() {
--uninstall) --uninstall)
_CMD="uninstall" _CMD="uninstall"
;; ;;
--upgrade)
_CMD="upgrade"
;;
--issue) --issue)
_CMD="issue" _CMD="issue"
;; ;;
@ -2765,6 +2788,7 @@ _process() {
case "${_CMD}" in case "${_CMD}" in
install) install "$_nocron" ;; install) install "$_nocron" ;;
uninstall) uninstall ;; uninstall) uninstall ;;
upgrade) upgrade ;;
issue) issue)
issue "$_webroot" "$_domain" "$_altdomains" "$_keylength" "$_certpath" "$_keypath" "$_capath" "$_reloadcmd" "$_fullchainpath" issue "$_webroot" "$_domain" "$_altdomains" "$_keylength" "$_certpath" "$_keypath" "$_capath" "$_reloadcmd" "$_fullchainpath"
;; ;;