diff --git a/easyrsa3/easyrsa b/easyrsa3/easyrsa index 523cb31..eb2a49d 100755 --- a/easyrsa3/easyrsa +++ b/easyrsa3/easyrsa @@ -226,6 +226,9 @@ non-empty values to options are mandatory. General options: --batch : set automatic (no-prompts when possible) mode +--silent : Disable all Warnings and Notices +--sbatch : Combined --silent and --batch operating mode + --passin=ARG : set -passin ARG for openssl --passout=ARG : set -passout ARG for openssl --pki-dir=DIR : declares the PKI directory @@ -280,20 +283,18 @@ $1" 1>&2 # non-fatal warning output warn() { - [ ! "$EASYRSA_BATCH" ] && \ - print " -$1" 1>&2 + [ "$EASYRSA_SILENT" ] && return + print "* Warning: - return 0 +$1" 1>&2 } # => warn() # informational notices to stdout notice() { - [ ! "$EASYRSA_BATCH" ] && \ - print " + [ "$EASYRSA_SILENT" ] && return + [ "$EASYRSA_BATCH" ] && return + print " $1" - - return 0 } # => notice() # yes/no case-insensitive match (operates on stdin pipe) @@ -984,7 +985,7 @@ gen_dh() { # check to see if we already have a dh parameters file if [ -e "$EASYRSA_PKI/dh.pem" ]; then - if [ "$EASYRSA_BATCH" = "1" ]; then + if [ "$EASYRSA_BATCH" ]; then # if batch is enabled, die die "file $EASYRSA_PKI/dh.pem already exists!" else @@ -1063,7 +1064,7 @@ $EASYRSA_EXTRA_EXTS" key_out_tmp="$(easyrsa_mktemp)" || die "Failed to create temporary file" req_out_tmp="$(easyrsa_mktemp)" || die "Failed to create temporary file" # generate request - [ $EASYRSA_BATCH ] && opts="$opts -batch" + [ "$EASYRSA_BATCH" ] && opts="$opts -batch" # shellcheck disable=2086,2148 algo_opts="" if [ "ed" = "$EASYRSA_ALGO" ]; then @@ -2743,6 +2744,13 @@ while :; do --batch) empty_ok=1 export EASYRSA_BATCH=1 ;; + --silent) + empty_ok=1 + export EASYRSA_SILENT=1 ;; + --silent-batch|--sbatch) + empty_ok=1 + export EASYRSA_SILENT=1 + export EASYRSA_BATCH=1 ;; --passin) export EASYRSA_PASSIN="$val";; --passout)