From cfbfeaae53b612bd304b4a9faf657a5ff2db48d0 Mon Sep 17 00:00:00 2001 From: Richard T Bonhomme Date: Wed, 25 May 2022 10:24:41 +0100 Subject: [PATCH] Add EasyRSA version to error output Signed-off-by: Richard T Bonhomme --- easyrsa3/easyrsa | 22 ++++++++++++++++------ 1 file changed, 16 insertions(+), 6 deletions(-) diff --git a/easyrsa3/easyrsa b/easyrsa3/easyrsa index ec816c5..e036d74 100755 --- a/easyrsa3/easyrsa +++ b/easyrsa3/easyrsa @@ -481,7 +481,7 @@ Easy-RSA error: $1" 1>&2 print " -Host: $host_out${EASYRSA_DEBUG+ +$host_out${EASYRSA_DEBUG+ *** Disable EASYRSA_DEBUG mode ***}" exit "${2:-1}" @@ -3226,7 +3226,8 @@ satisfy_shellcheck() { # Identify host OS detect_host() { - unset -v easyrsa_host_os easyrsa_host_test easyrsa_win_git_bash + unset -v easyrsa_ver_test easyrsa_host_os easyrsa_host_test \ + easyrsa_win_git_bash # Detect Windows [ "${OS}" ] && easyrsa_host_test="${OS}" @@ -3251,11 +3252,19 @@ detect_host() { else easyrsa_host_os=nix easyrsa_uname="$(uname 2>/dev/null)" - easyrsa_shell="$SHELL" + easyrsa_shell="${SHELL:-undefined}" fi - host_out="$easyrsa_host_os | $easyrsa_uname | $easyrsa_shell" + + easyrsa_ver_test="${EASYRSA_version%%~*}" + if [ "$easyrsa_ver_test" ]; then + host_out="Version: $EASYRSA_version" + else + host_out="Version: dev" + fi + + host_out="${host_out} | $easyrsa_host_os | $easyrsa_uname | $easyrsa_shell" host_out="${host_out}${easyrsa_win_git_bash+ | "$easyrsa_win_git_bash"}" - unset -v easyrsa_host_test + unset -v easyrsa_ver_test easyrsa_host_test } # => detect_host() # Verify the selected algorithm parameters @@ -4138,7 +4147,7 @@ print_version() ssl_version="$("${EASYRSA_OPENSSL:-openssl}" version)" cat << VERSION_TEXT EasyRSA Version Information -Version: ~VER~ +Version: $EASYRSA_version Generated: ~DATE~ SSL Lib: $ssl_version Git Commit: ~GITHEAD~ @@ -4150,6 +4159,7 @@ VERSION_TEXT ######################################## # Invocation entry point: +EASYRSA_version="~VER~" NL=' '