Print error and exit when vars not found on upgrade

When a vars file cannot be found, the up23_manage_upgrade_23() function
will now exit and print a message stating such.  Previously, it exited
silently.

Fixes #377.

Signed-off-by: Eric F Crist <ecrist@secure-computing.net>
This commit is contained in:
Eric F Crist 2020-09-02 10:22:48 -05:00
parent 2db812160e
commit 8b0e302337
No known key found for this signature in database
GPG Key ID: 72964219390D0D0E
2 changed files with 6 additions and 1 deletions

View File

@ -7,6 +7,7 @@ Easy-RSA 3 ChangeLog
* Fixed issue with ED/EC certificates were still signed by RSA (#374)
* Added support for export-p8 (#339)
* Clarified error message (#384)
* 2->3 upgrade now errors and prints message when vars isn't found (#377)
3.0.7 (2020-03-30)
* Include OpenSSL libs and binary for Windows 1.1.0j

View File

@ -2197,6 +2197,7 @@ up23_manage_upgrade_23 ()
{
EASYRSA_UPGRADE_VERSION="v1.0a (2020/01/08)"
EASYRSA_UPGRADE_TYPE="$1"
EASYRSA_FOUND_VARS=0
# Verify all existing versions of vars/vars.bat
if [ -f "$vars" ]
@ -2225,7 +2226,10 @@ up23_manage_upgrade_23 ()
EASYRSA_TARGET_VARSFILE="$EASYRSA/vars"
fi
[ "$EASYRSA_FOUND_VARS" ] || return 0
if [ $EASYRSA_FOUND_VARS -ne 1 ];
then
die echo "vars file not found"
fi
# Only allow specific vars/vars.bat to exist
if [ "$EASYRSA_VARS_IS_VER3" ] && [ "$EASYRSA_VARS_IS_VER2" ]