aboutsummaryrefslogtreecommitdiffstats
path: root/lfacme-renew.sh
diff options
context:
space:
mode:
authorLexi Winter <ivy@FreeBSD.org>2025-06-03 09:53:49 +0100
committerLexi Winter <ivy@FreeBSD.org>2025-06-03 09:53:49 +0100
commit6e4bfc59487dbb9d5c80d2debe98f769fe244577 (patch)
tree24f9386619f6068925e037b4254859acc0ecc0e0 /lfacme-renew.sh
parent65401ae5872e76f5ceab0c0e808d1e4823c6c0dc (diff)
downloadlfacme-6e4bfc59487dbb9d5c80d2debe98f769fe244577.tar.gz
lfacme-6e4bfc59487dbb9d5c80d2debe98f769fe244577.tar.bz2
improve path handling
- allow a different configuration directory to be specified with '-c' - since acme.conf allows the uacme directory to be changed, this allows the user to change both. - use /var/db/lfacme as the default datadir instead of putting data in /etc.
Diffstat (limited to 'lfacme-renew.sh')
-rw-r--r--lfacme-renew.sh29
1 files changed, 17 insertions, 12 deletions
diff --git a/lfacme-renew.sh b/lfacme-renew.sh
index e29788c..ce7c7f2 100644
--- a/lfacme-renew.sh
+++ b/lfacme-renew.sh
@@ -1,17 +1,8 @@
#! /bin/sh
# This source code is released into the public domain.
-. /usr/local/share/lfacme/init.sh
-
-if ! [ -d "$_UACME_DIR" ]; then
- _fatal "run lfacme-setup first"
-fi
-
-if ! [ -f "$_DOMAINS" ]; then
- _fatal "missing $_DOMAINS"
-fi
-
-args=$(getopt v $*)
+# Parse command-line arguments.
+args=$(getopt c:v $*)
if [ $? -ne 0 ]; then
exit 1
fi
@@ -22,14 +13,28 @@ _uacme_flags="--no-ari"
while :; do
case "$1" in
+ -c)
+ _CONFDIR="$2"
+ shift; shift;;
-v)
- _uacme_flags="$_uacme_flags -v"
+ _uacme_flags="$_uacme_flags $1"
shift;;
--)
shift; break;;
esac
done
+# Initialise.
+. /usr/local/share/lfacme/init.sh
+
+if ! [ -f "$_UACME_DIR/private/key.pem" ]; then
+ _fatal "run lfacme-setup first"
+fi
+
+if ! [ -f "$_DOMAINS" ]; then
+ _fatal "missing $_DOMAINS"
+fi
+
# Create a key if it doesn't already exist. It would be better to always
# create a new key here, but currently uacme doesn't have a way to tell us
# that we need to do that.