Improve detect_host() and show_host()

Squashed commit of the following:

commit 5d48d39891b8ecd8c34f6faef1de06d327ed2b18
Merge: c905f09 2cfc18c
Author: Richard T Bonhomme <tincantech@protonmail.com>
Date:   Thu Nov 3 21:56:48 2022 +0000

    Merge branch 'restrain-detect_host' of ssh://github.com/TinCanTech/easy-rsa into TinCanTech-restrain-detect_host

    Signed-off-by: Richard T Bonhomme <tincantech@protonmail.com>

commit 2cfc18c46bb23d1a2e88502ee76faf373f848155
Author: Richard T Bonhomme <tincantech@protonmail.com>
Date:   Thu Nov 3 21:15:09 2022 +0000

    Improve detect_host() and show_host()

    These changes make reductions to:
    - The effects of detect_host()
    - The output of show_host()

    detect_host:
    - Does not set an SSL library.
    - Is not essential, so can be run before all other essential code.

    show_host:
    - Only show extended details for -v 'verbose' output.

    Signed-off-by: Richard T Bonhomme <tincantech@protonmail.com>

Signed-off-by: Richard T Bonhomme <tincantech@protonmail.com>
This commit is contained in:
Richard T Bonhomme 2022-11-03 21:59:56 +00:00
parent c905f0929a
commit 82483f103e
No known key found for this signature in database
GPG Key ID: 2D767DB92FB6C246

View File

@ -3920,7 +3920,7 @@ detect_host() {
easyrsa_shell="$SHELL (Git)"
easyrsa_win_git_bash="${EXEPATH}"
# If found then set openssl NOW!
[ -e /usr/bin/openssl ] && set_var EASYRSA_OPENSSL /usr/bin/openssl
#[ -e /usr/bin/openssl ] && set_var EASYRSA_OPENSSL /usr/bin/openssl
fi
else
easyrsa_host_os=nix
@ -3943,7 +3943,8 @@ detect_host() {
# Extra diagnostics
show_host() {
print_version
print "$host_out | ${ssl_version:-ssl_version not currently set}"
[ "$EASYRSA_VERBOSE" ] || return 0
print "$host_out"
[ "$EASYRSA_DEBUG" ] || return 0
case "$easyrsa_host_os" in
win) set ;;
@ -4890,6 +4891,9 @@ trap "exit 3" 3
trap "exit 6" 6
trap "exit 14" 15
# Get host details - No configurable input allowed
detect_host
# Initialisation requirements
unset -v die_error_exit easyrsa_error_exit \
user_san_true user_vars_true alias_days
@ -5077,9 +5081,6 @@ case "$cmd" in
unset -v no_pki_required
esac
# Get host details - does not require vars_setup
detect_host
# Mutual exclusions
# --nopass cannot be used with --passin and --passout
if [ "$EASYRSA_NO_PASS" ] && \