Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
ruanhaishen
Acme.Sh
Commits
635695ec
Commit
635695ec
authored
Apr 16, 2016
by
neil
Browse files
add `--useragent` to specify user-aggent for install or issue or other command
parent
41e3eafa
Changes
1
Hide whitespace changes
Inline
Side-by-side
acme.sh
View file @
635695ec
#!/usr/bin/env bash
VER
=
2.1.
0
VER=2.1.
1
PROJECT_NAME="acme.sh"
...
...
@@ -685,8 +685,10 @@ _initpath() {
_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
...
...
@@ -1670,7 +1672,7 @@ _initconf() {
#ACCOUNT_KEY_HASH=account key hash
USER_AGENT=
\"
$
DEFAULT_
USER_AGENT
\"
USER_AGENT=\"$USER_AGENT\"
#USER_PATH=""
...
...
@@ -1732,11 +1734,12 @@ _precheck() {
}
install() {
if ! _initpath ; then
_err "Install failed."
return 1
fi
if ! _precheck ; then
_err "Pre-check failed, can not install."
return 1
...
...
@@ -1760,7 +1763,7 @@ install() {
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
...
...
@@ -1807,11 +1810,9 @@ install() {
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
...
...
@@ -1890,7 +1891,8 @@ Parameters:
--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.
"
}
...
...
@@ -1935,6 +1937,8 @@ _process() {
_fullchainpath="no"
_reloadcmd="no"
_password=""
_accountconf=""
_useragent=""
while (( ${#} )); do
case "${1}" in
...
...
@@ -2087,7 +2091,7 @@ _process() {
_fullchainpath="$2"
shift
;;
--reloadcmd
)
--reloadcmd
|--reloadCmd
)
_reloadcmd="$2"
shift
;;
...
...
@@ -2096,14 +2100,19 @@ _process() {
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
...
...
@@ -2155,6 +2164,10 @@ _process() {
;;
esac
if [[ "$_useragent" ]] ; then
_saveaccountconf "USER_AGENT" "$_useragent"
fi
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment