Fix version information and avoid warnings for version and help

Signed-off-by: Richard T Bonhomme <tincantech@protonmail.com>
This commit is contained in:
Richard T Bonhomme 2022-04-13 15:09:41 +01:00
parent f4af868cbc
commit d7b5c98d69
No known key found for this signature in database
GPG Key ID: 2D767DB92FB6C246

View File

@ -805,6 +805,7 @@ current CA keypair. If you intended to start a new CA, run init-pki first."
out_key_tmp="$(easyrsa_mktemp)" || die "Failed to create temporary file" out_key_tmp="$(easyrsa_mktemp)" || die "Failed to create temporary file"
out_file_tmp="$(easyrsa_mktemp)" || die "Failed to create temporary file" out_file_tmp="$(easyrsa_mktemp)" || die "Failed to create temporary file"
# Get password from user if necessary # Get password from user if necessary
if [ -z "$nopass" ] && { if [ -z "$nopass" ] && {
[ -z "$EASYRSA_PASSOUT" ] || [ -z "$EASYRSA_PASSIN" ] [ -z "$EASYRSA_PASSOUT" ] || [ -z "$EASYRSA_PASSIN" ]
@ -1201,7 +1202,7 @@ File Path: $req_in"
# Display the request subject in an easy-to-read format # Display the request subject in an easy-to-read format
# Confirm the user wishes to sign this request # Confirm the user wishes to sign this request
confirm "Confirm request details: " "yes" " confirm "Confirm request details: " "yes" "\
You are about to sign the following certificate. You are about to sign the following certificate.
Please check over the details shown below for accuracy. Note that this request Please check over the details shown below for accuracy. Note that this request
has not been cryptographically verified. Please be sure it came from a trusted has not been cryptographically verified. Please be sure it came from a trusted
@ -2180,7 +2181,7 @@ Sourcing the vars file will probably fail .."
EASYRSA_CALLER=1 EASYRSA_CALLER=1
# shellcheck disable=1090 # can't follow non-constant source. vars # shellcheck disable=1090 # can't follow non-constant source. vars
. "$vars" . "$vars"
notice "Note: using Easy-RSA configuration from: $vars" notice "Using Easy-RSA configuration from: $vars"
[ "$vars_in_pki" ] || \ [ "$vars_in_pki" ] || \
warn "Move your vars file to your PKI folder, where it is safe!" warn "Move your vars file to your PKI folder, where it is safe!"
else else
@ -2894,14 +2895,15 @@ return 0
print_version() print_version()
{ {
cat <<HERE ssl_version="$("${EASYRSA_OPENSSL:-openssl}" version)"
cat << VERSION_TEXT
EasyRSA Version Information EasyRSA Version Information
Version: ~VER~ Version: ~VER~
Generated: ~DATE~ Generated: ~DATE~
SSL Lib: $($EASYRSA_OPENSSL version) SSL Lib: $ssl_version
Git Commit: ~GITHEAD~ Git Commit: ~GITHEAD~
Source Repo: https://github.com/OpenVPN/easy-rsa Source Repo: https://github.com/OpenVPN/easy-rsa
HERE VERSION_TEXT
exit 0 exit 0
} # => print_version () } # => print_version ()
@ -2993,7 +2995,9 @@ while :; do
$EASYRSA_EXTRA_EXTS $EASYRSA_EXTRA_EXTS
subjectAltName = $val" ;; subjectAltName = $val" ;;
--version) --version)
print_version shift "$#"
set -- "$@" "version"
break
;; ;;
*) *)
break ;; break ;;
@ -3010,8 +3014,13 @@ done
# Set cmd now because vars_setup needs to know if this is init-pki # Set cmd now because vars_setup needs to know if this is init-pki
cmd="$1" cmd="$1"
[ -n "$1" ] && shift # scrape off command [ -n "$1" ] && shift # scrape off command
# This avoids unnecessary warnings and notices
# want_init_pki can probably be renamed to something more apt
case "$cmd" in case "$cmd" in
init-pki|clean-all) want_init_pki=1 ;; init-pki|clean-all) want_init_pki=1 ;;
""|help|-h|--help|--usage) want_init_pki=1 ;;
version) want_init_pki=1 ;;
*) unset -v want_init_pki *) unset -v want_init_pki
esac esac