#!/usr/bin/env bash
-VER=2.1.0
+VER=2.1.1
PROJECT_NAME="acme.sh"
_DEFAULT_ACCOUNT_CONF_PATH="$LE_WORKING_DIR/account.conf"
- if [[ -f "$_DEFAULT_ACCOUNT_CONF_PATH" ]] ; then
- source "$_DEFAULT_ACCOUNT_CONF_PATH"
+ if [[ -z "$ACCOUNT_CONF_PATH" ]] ; then
+ if [[ -f "$_DEFAULT_ACCOUNT_CONF_PATH" ]] ; then
+ source "$_DEFAULT_ACCOUNT_CONF_PATH"
+ fi
fi
if [[ -z "$ACCOUNT_CONF_PATH" ]] ; then
#ACCOUNT_KEY_HASH=account key hash
-USER_AGENT=\"$DEFAULT_USER_AGENT\"
+USER_AGENT=\"$USER_AGENT\"
#USER_PATH=""
}
install() {
+
if ! _initpath ; then
_err "Install failed."
return 1
fi
-
+
if ! _precheck ; then
_err "Pre-check failed, can not install."
return 1
fi
_info "Installing to $LE_WORKING_DIR"
-
+
if ! mkdir -p "$LE_WORKING_DIR" ; then
_err "Can not craete working dir: $LE_WORKING_DIR"
return 1
if [[ ! -f "$ACCOUNT_CONF_PATH" ]] ; then
_initconf
fi
-
- _setopt "$_DEFAULT_ACCOUNT_CONF_PATH" "ACCOUNT_CONF_PATH" "=" "\"$ACCOUNT_CONF_PATH\""
if [[ "$_DEFAULT_ACCOUNT_CONF_PATH" != "$ACCOUNT_CONF_PATH" ]] ; then
- _setopt "$ACCOUNT_CONF_PATH" "ACCOUNT_CONF_PATH" "=" "\"$ACCOUNT_CONF_PATH\""
+ _setopt "$_DEFAULT_ACCOUNT_CONF_PATH" "ACCOUNT_CONF_PATH" "=" "\"$ACCOUNT_CONF_PATH\""
fi
installcronjob
--reloadcmd \"service nginx reload\" After issue/renew, it's used to reload the server.
--accountconf Specifies a customized account config file.
- --home Specifies the home dir for $PROJECT_NAME
+ --home Specifies the home dir for $PROJECT_NAME .
+ --useragent Specifies the user agent string. it will be saved for future use too.
"
}
_fullchainpath="no"
_reloadcmd="no"
_password=""
+ _accountconf=""
+ _useragent=""
while (( ${#} )); do
case "${1}" in
_fullchainpath="$2"
shift
;;
- --reloadcmd)
+ --reloadcmd|--reloadCmd)
_reloadcmd="$2"
shift
;;
shift
;;
--accountconf)
- ACCOUNT_CONF_PATH="$2"
+ _accountconf="$2"
+ ACCOUNT_CONF_PATH="$_accountconf"
shift
;;
--home)
LE_WORKING_DIR="$2"
shift
;;
-
+ --useragent)
+ _useragent="$2"
+ USER_AGENT="$_useragent"
+ shift
+ ;;
*)
_err "Unknown parameter : $1"
return 1
;;
esac
+ if [[ "$_useragent" ]] ; then
+ _saveaccountconf "USER_AGENT" "$_useragent"
+ fi
+
}