aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--init.sh.in31
-rw-r--r--lfacme.sh.in2
-rw-r--r--renew.sh.in3
3 files changed, 15 insertions, 21 deletions
diff --git a/init.sh.in b/init.sh.in
index f8a8474..a9bda11 100644
--- a/init.sh.in
+++ b/init.sh.in
@@ -45,20 +45,16 @@ _BASEDIR="__PREFIX__"
_SHARE="${_BASEDIR}/share/lfacme"
_CHALLENGE="${_SHARE}/challenge"
-# Our configuration directory. If $_CONFDIR is already set, then the script
-# wants to provide its own config directory, probably from a command line
-# argument. Otherwise if $LFACME_CONFDIR is set, we're running in a hook
-# script, so use that as the config directory. Otherwise, use the default.
-if [ -z "$_CONFDIR" ]; then
- if ! [ -z "$LFACME_CONFDIR" ]; then
- _CONFDIR="$LFACME_CONFDIR"
- else
- _CONFDIR="${_BASEDIR}/etc/lfacme"
- fi
+# Our configuration directory. If $LFACME_CONFDIR is already set, it came from
+# the environment or a command line option, so keep the existing value.
+if [ -z "$LFACME_CONFDIR" ]; then
+ LFACME_CONFDIR="__CONFDIR__"
fi
+# Export this so it's available to hooks.
+export LFACME_CONFDIR
# Our configuration file.
-_CONFIG="${_CONFDIR}/acme.conf"
+_CONFIG="${LFACME_CONFDIR}/acme.conf"
# Read and validate the configuration file.
@@ -75,7 +71,7 @@ if [ -z "$LFACME_DATADIR" ]; then
fi
if [ -z "$LFACME_HOOKDIR" ]; then
- LFACME_HOOKDIR="${_CONFDIR}/hooks"
+ LFACME_HOOKDIR="${LFACME_CONFDIR}/hooks"
fi
# Create our data directory.
@@ -88,7 +84,7 @@ if [ ! -d "$LFACME_DATADIR" ]; then
fi
# The domains.conf file.
-_DOMAINS="${_CONFDIR}/domains.conf"
+_DOMAINS="${LFACME_CONFDIR}/domains.conf"
# Find a program based on $PATH, or return the second argument if specified.
# If the program isn't found, print an error and exit.
@@ -134,15 +130,14 @@ if ! [ -z "$LFACME_VERBOSE" ]; then
fi
_uacme() {
- env "LFACME_CONFDIR=${_CONFDIR}" \
- "LFACME_VERBOSE=${LFACME_VERBOSE}" \
+ env "LFACME_VERBOSE=${LFACME_VERBOSE}" \
"$_UACME" $_LFACME_UACME_FLAGS \
-a "$LFACME_URL" -c "$_UACME_DIR" "$@"
}
# Find a challenge script and make sure it's valid. If the challenge name
# begins with a '/' it's a full path, otherwise we search $_CHALLENGE and
-# $_CONFDIR/challenge.
+# $LFACME_CONFDIR/challenge.
_findchallenge() {
local identifier="$1"
local challenge="$2"
@@ -152,8 +147,8 @@ _findchallenge() {
path="${challenge}"
elif [ -f "${_CHALLENGE}/${challenge}" ]; then
path="${_CHALLENGE}/${challenge}"
- elif [ -f "${_CONFDIR}/challenge/${challenge}" ]; then
- path="${_CONFDIR}/challenge/${challenge}"
+ elif [ -f "${LFACME_CONFDIR}/challenge/${challenge}" ]; then
+ path="${LFACME_CONFDIR}/challenge/${challenge}"
else
_error "%s: could not find challenge script '%s'" \
"$identifier" "$challenge"
diff --git a/lfacme.sh.in b/lfacme.sh.in
index aaf23e9..fc29e3d 100644
--- a/lfacme.sh.in
+++ b/lfacme.sh.in
@@ -13,7 +13,7 @@ _uacme_flags=""
while :; do
case "$1" in
-c)
- _CONFDIR="$2"
+ LFACME_CONFDIR="$2"
shift; shift;;
-v)
LFACME_VERBOSE=1
diff --git a/renew.sh.in b/renew.sh.in
index c0d9121..de46bb0 100644
--- a/renew.sh.in
+++ b/renew.sh.in
@@ -226,8 +226,7 @@ _docert() {
# so run the hooks.
for hook in $_rhooks; do
_verbose "running hook: %s" "$hook"
- env "LFACME_CONFDIR=${_CONFDIR}" \
- "LFACME_VERBOSE=${LFACME_VERBOSE}" \
+ env "LFACME_VERBOSE=${LFACME_VERBOSE}" \
"LFACME_CERT=${identifier}" \
"LFACME_KEYFILE=${keyfile}" \
"LFACME_CERTFILE=${certfile}" \