From e24bf0a72e9337e4b753c85a47df4726cc8e89b6 Mon Sep 17 00:00:00 2001 From: Richard T Bonhomme Date: Mon, 22 Aug 2022 22:37:27 +0100 Subject: [PATCH] cleanup: Make "clean line" respect silent, batch and quiet modes Improve two comments and information() output Signed-off-by: Richard T Bonhomme --- easyrsa3/easyrsa | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/easyrsa3/easyrsa b/easyrsa3/easyrsa index 684c84680..25f7a6a98 100755 --- a/easyrsa3/easyrsa +++ b/easyrsa3/easyrsa @@ -525,8 +525,7 @@ notice() { print " Notice ------ -$1 -" +$1" } # => notice() # Helpful information @@ -534,7 +533,7 @@ information() { [ "$EASYRSA_SILENT" ] && return [ "$EASYRSA_BATCH" ] && return [ "$EASYRSA_QUIET" ] && return - print "* $1" + print "$1" } # => notice() # yes/no case-insensitive match (operates on stdin pipe) @@ -656,6 +655,13 @@ cleanup() { *) warn "Host OS undefined." esac + if [ "$EASYRSA_SILENT" ] || [ "$EASYRSA_BATCH" ] || [ "$EASYRSA_QUIET" ] + then + : # ok + else + print # just to get a clean line + fi + # Exit with error 1, if an error ocured... if [ "$easyrsa_error_exit" ]; then # Set by verify_cert() for full error-out @@ -665,7 +671,6 @@ cleanup() { exit 0 else # if 'cleanup' is called without 'ok' then an error occurred - [ "$EASYRSA_SILENT" ] || print # just to get a clean line exit 1 fi } # => cleanup() @@ -981,8 +986,7 @@ Your newly created PKI dir is: : # ok - No message required else information "\ -IMPORTANT: Easy-RSA 'vars' file has now been moved to your PKI above. -" +IMPORTANT: Easy-RSA 'vars' file has now been moved to your PKI above." fi } # => init_pki() @@ -1114,7 +1118,6 @@ install_data_to_pki () { #[ -e "${EASYRSA_PKI}/${vars_file}" ] || return #[ -e "${EASYRSA_PKI}/${vars_file_example}" ] || return [ -e "${EASYRSA_PKI}/${ssl_cnf_file}" ] || return - #[ -e "${EASYRSA_PKI}/${x509_types_dir}" ] || return # EASYRSA_EXT_DIR must be found! No exceptions! # The shellcheck warning 2015 is valid, however, this code works correctly. @@ -1123,7 +1126,7 @@ install_data_to_pki () { [ "$EASYRSA_EXT_DIR" ] && [ -e "$EASYRSA_EXT_DIR" ] || \ die "x509-types folder cannot be found: $EASYRSA_EXT_DIR" - # Complete or error + # Create a safe ssl file, Complete or error require_safe_ssl_conf=1 # Always required [ -e "$EASYRSA_SAFE_CONF" ] || easyrsa_openssl makesafeconf || return