Detect and filter erroneous duplicate "found 'vars' files"

When 'vars' is in the same directory as 'easyrsa' and they are both
in the current working directory, easyrsa would falsely warn about
"conflicting" 'vars' files.

Filter out this false error by checking if '$prog_dir' is './'

Signed-off-by: Richard T Bonhomme <tincantech@protonmail.com>
This commit is contained in:
Richard T Bonhomme 2022-05-05 12:37:35 +01:00
parent 87e514e3b6
commit 0948e81304
No known key found for this signature in database
GPG Key ID: 2D767DB92FB6C246

View File

@ -2561,6 +2561,7 @@ vars_setup() {
#prog_file2="$(which -- "$prog_file" 2>/dev/null)" && prog_file="$prog_file2"
#prog_file2="$(readlink -f "$prog_file" 2>/dev/null)" && prog_file="$prog_file2"
prog_dir="${prog_file%/*}"
if [ "$prog_dir" = . ]; then prog_in_pwd=1; else unset -v prog_in_pwd; fi
# Program dir vars - This location is least wanted.
prog_vars="${prog_dir}/vars"
@ -2611,6 +2612,11 @@ vars_setup() {
# program location:
{ [ -e "$prog_vars" ] && e_prog_vars=1; } || unset -v prog_vars
# Filter duplicates
if [ "$prog_vars" ] && [ "$pwd_vars" ] && [ "$prog_in_pwd" ]; then
unset -v prog_vars e_prog_vars
fi
# Allow only one vars to be found, No exceptions!
found_vars="$((e_pki_vars + e_easy_vars + e_pwd_vars + e_prog_vars))"