Skip to content

Commit 12ecc1a

Browse files
committed
select_vars(): Minor improvements
Remove unnecessary check for 'EASYRSA_VARS_FILE is unset', which is confirmed by the first function 'if'. Only quote parameter expansion and allow editor to show fixed values. Move 'set_var' command above 'verbose' output. Signed-off-by: Richard T Bonhomme <[email protected]>
1 parent 3a6fa3c commit 12ecc1a

File tree

1 file changed

+11
-21
lines changed

1 file changed

+11
-21
lines changed

easyrsa3/easyrsa

Lines changed: 11 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -5498,48 +5498,38 @@ select_vars() {
54985498

54995499
# User specified PKI; if vars exists, use it ONLY
55005500
if [ "$EASYRSA_PKI" ]; then
5501-
if [ -f "$EASYRSA_PKI/vars" ]; then
5501+
if [ -f "$EASYRSA_PKI"/vars ]; then
5502+
set_var EASYRSA_VARS_FILE "$EASYRSA_PKI"/vars
55025503
verbose "select_vars: source EASYRSA_PKI/vars"
5503-
set_var EASYRSA_VARS_FILE "$EASYRSA_PKI/vars"
55045504
fi
55055505
fi
55065506

55075507
# User specified EASYRSA; if vars exists, use it ONLY
55085508
if [ "$EASYRSA" ]; then
5509-
if [ -f "$EASYRSA/vars" ]; then
5509+
if [ -f "$EASYRSA"/vars ]; then
5510+
set_var EASYRSA_VARS_FILE "$EASYRSA"/vars
55105511
verbose "select_vars: EASYRSA/vars"
5511-
set_var EASYRSA_VARS_FILE "$EASYRSA/vars"
55125512
fi
55135513
fi
55145514

55155515
# Default PKI; if vars exists, use it ONLY
5516-
if [ -f "$PWD/pki/vars" ] && \
5516+
if [ -f "$PWD"/pki/vars ] && \
55175517
[ -z "$EASYRSA_PKI" ] && \
55185518
[ -z "$EASYRSA" ]
55195519
then
5520-
# Prevent vars from changing expected PKI.
5520+
# Prevent vars from changing 'expected' PKI.
55215521
# A vars in the PKI MUST always imply EASYRSA_PKI
5522-
# This is NOT backward compatible
5523-
# Use expected value comparison for v3.1.7
5524-
if [ -z "$EASYRSA_VARS_FILE" ]; then
5525-
expected_EASYRSA="$PWD"
5526-
expected_EASYRSA_PKI="$PWD/pki"
5527-
fi
5528-
5529-
# Use this for v3.2.0
5530-
# If the pki/vars sets a different PKI then
5531-
# there will be no PKI in the default /pki
5532-
#set_var EASYRSA "$PWD"
5533-
#set_var EASYRSA_PKI "$EASYRSA/pki"
5522+
expected_EASYRSA="$PWD"
5523+
expected_EASYRSA_PKI="$PWD"/pki
55345524

5525+
set_var EASYRSA_VARS_FILE "$PWD"/pki/vars
55355526
verbose "select_vars: PWD/pki/vars"
5536-
set_var EASYRSA_VARS_FILE "$PWD/pki/vars"
55375527
fi
55385528

55395529
# Default working dir; if vars exists, use it ONLY
5540-
if [ -f "$PWD/vars" ]; then
5530+
if [ -f "$PWD"/vars ]; then
5531+
set_var EASYRSA_VARS_FILE "$PWD"/vars
55415532
verbose "select_vars: PWD/vars"
5542-
set_var EASYRSA_VARS_FILE "$PWD/vars"
55435533
fi
55445534
fi
55455535

0 commit comments

Comments
 (0)