From d7b5c98d69fc8f44992e741e008976e4c80b380f Mon Sep 17 00:00:00 2001 From: Richard T Bonhomme Date: Wed, 13 Apr 2022 15:09:41 +0100 Subject: [PATCH] Fix version information and avoid warnings for version and help Signed-off-by: Richard T Bonhomme --- easyrsa3/easyrsa | 21 +++++++++++++++------ 1 file changed, 15 insertions(+), 6 deletions(-) diff --git a/easyrsa3/easyrsa b/easyrsa3/easyrsa index ac61125..3b88bb2 100755 --- a/easyrsa3/easyrsa +++ b/easyrsa3/easyrsa @@ -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_file_tmp="$(easyrsa_mktemp)" || die "Failed to create temporary file" + # Get password from user if necessary if [ -z "$nopass" ] && { [ -z "$EASYRSA_PASSOUT" ] || [ -z "$EASYRSA_PASSIN" ] @@ -1201,7 +1202,7 @@ File Path: $req_in" # Display the request subject in an easy-to-read format # 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. 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 @@ -2180,7 +2181,7 @@ Sourcing the vars file will probably fail .." EASYRSA_CALLER=1 # shellcheck disable=1090 # can't follow non-constant source. vars . "$vars" - notice "Note: using Easy-RSA configuration from: $vars" + notice "Using Easy-RSA configuration from: $vars" [ "$vars_in_pki" ] || \ warn "Move your vars file to your PKI folder, where it is safe!" else @@ -2894,14 +2895,15 @@ return 0 print_version() { - cat < print_version () @@ -2993,7 +2995,9 @@ while :; do $EASYRSA_EXTRA_EXTS subjectAltName = $val" ;; --version) - print_version + shift "$#" + set -- "$@" "version" + break ;; *) break ;; @@ -3010,8 +3014,13 @@ done # Set cmd now because vars_setup needs to know if this is init-pki cmd="$1" [ -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 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 esac