From 6e4bfc59487dbb9d5c80d2debe98f769fe244577 Mon Sep 17 00:00:00 2001 From: Lexi Winter Date: Tue, 3 Jun 2025 09:53:49 +0100 Subject: 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. --- lfacme-renew.sh | 29 +++++++++++++++++------------ 1 file changed, 17 insertions(+), 12 deletions(-) (limited to 'lfacme-renew.sh') 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. -- cgit v1.2.3