Save user's PATH for cron job.

This commit is contained in:
neil 2016-04-05 21:08:19 +08:00
parent df886ffa25
commit 281aa3497f

21
le.sh
View File

@ -1,5 +1,5 @@
#!/usr/bin/env bash
VER=1.2.1
VER=1.2.2
PROJECT="https://github.com/Neilpang/le"
DEFAULT_CA="https://acme-v01.api.letsencrypt.org"
@ -585,7 +585,7 @@ _saveaccountconf() {
key="$1"
value="$2"
if [ "$ACCOUNT_CONF_PATH" ] ; then
_setopt $ACCOUNT_CONF_PATH "$key" "=" "$value"
_setopt $ACCOUNT_CONF_PATH "$key" "=" "\"$value\""
else
_err "ACCOUNT_CONF_PATH is empty, can not save $key=$value"
fi
@ -645,6 +645,13 @@ _initpath() {
source "$ACCOUNT_CONF_PATH"
fi
if [[ "$IN_CRON" ]] ; then
if [[ ! "$_USER_PATH_EXPORTED" ]] ; then
_USER_PATH_EXPORTED=1
export PATH="$USER_PATH:$PATH"
fi
fi
if [ -z "$API" ] ; then
if [ -z "$STAGE" ] ; then
API="$DEFAULT_CA"
@ -1205,6 +1212,11 @@ issue() {
_info "Your cert is in $CERT_PATH"
cp "$CERT_PATH" "$CERT_FULLCHAIN_PATH"
if [[ ! "$USER_PATH" ]] || [[ ! "$IN_CRON" ]] ; then
USER_PATH="$PATH"
_saveaccountconf "USER_PATH" "$USER_PATH"
fi
fi
@ -1474,6 +1486,9 @@ _initconf() {
#ACCOUNT_KEY_HASH=account key hash
USER_AGENT=\"le.sh client: $PROJECT\"
#USER_PATH=""
#dns api
#######################
#Cloudflare:
@ -1605,7 +1620,9 @@ uninstall() {
}
cron() {
IN_CRON=1
renewAll
IN_CRON=""
}
version() {