From 924159c611a048193ce356af2787f8574af7e908 Mon Sep 17 00:00:00 2001 From: Richard T Bonhomme Date: Tue, 12 Sep 2023 01:30:41 +0100 Subject: [PATCH] source_vars(): 'init-pki', prioritise USER set EASYRSA_PKI and EASYRSA When souring 'vars' file, allow user set EASYRSA_PKI and EASYRSA to take priority over default settings. This will still error out when default 'pki/vars' sets EASYRSA_PKI to a non-default PKI. Signed-off-by: Richard T Bonhomme --- easyrsa3/easyrsa | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/easyrsa3/easyrsa b/easyrsa3/easyrsa index 4f4115c53..42f791588 100755 --- a/easyrsa3/easyrsa +++ b/easyrsa3/easyrsa @@ -5785,11 +5785,19 @@ Remove 'unset' ('force_set_var' may also work)." # Required for init-pki case "$cmd" in init-pki|clean-all) - expected_pki="${expected_pki:-"$PWD/pki"}" + if [ "$EASYRSA_PKI" ]; then + expected_pki="${expected_pki:-"$EASYRSA_PKI"}" + elif [ "$EASYRSA" ]; then + expected_pki="${expected_pki:-"$EASYRSA/pki"}" + else + expected_pki="${expected_pki:-"$PWD/pki"}" + fi ;; *) : # ok esac +echo WOOOHOOO + # Set defaults, preferring existing env-vars if present set_var EASYRSA "$PWD" set_var EASYRSA_OPENSSL openssl