Another fix of output design

This commit is contained in:
Evgeny Sinelnikov 2022-04-08 05:24:26 +04:00
parent e6135848bc
commit 37794dc6f1

View File

@ -28,6 +28,13 @@ msg_done()
echo "]" echo "]"
} }
_command()
{
color_message "\$ $*" bold
$*
echo
}
run_by_root() run_by_root()
{ {
local msg= local msg=
@ -43,7 +50,7 @@ run_by_root()
else else
test -z "$msg" || test -z "$msg" ||
echo -n "$msg: " echo -n "$msg: "
$* || return 1 _command $* || return 1
fi fi
} }
@ -53,6 +60,7 @@ run()
local func="$1" local func="$1"
local msg=$(printf "/====== %-52s ======" "$func") local msg=$(printf "/====== %-52s ======" "$func")
test -z $verbose || echo " /============================================================================="
if test -z $verbose; then if test -z $verbose; then
$func >/dev/null 2>&1 && retval=0 || retval=$? $func >/dev/null 2>&1 && retval=0 || retval=$?
else else
@ -74,7 +82,7 @@ check_hostnamectl()
{ {
local static_host="$(hostnamectl --static)" local static_host="$(hostnamectl --static)"
local transient_host="$(hostname)" local transient_host="$(hostname)"
hostnamectl _command hostnamectl
test "$static_host" = "$transient_host" test "$static_host" = "$transient_host"
} }
@ -88,9 +96,9 @@ check_system_auth()
{ {
local auth=$(/usr/sbin/control system-auth) local auth=$(/usr/sbin/control system-auth)
echo "control system_auth: $auth" echo "control system_auth: $auth"
readlink -f /etc/pam.d/system-auth _command readlink -f /etc/pam.d/system-auth
echo ------------------------------------------------------------------------------- echo -------------------------------------------------------------------------------
cat /etc/pam.d/system-auth _command cat /etc/pam.d/system-auth
echo ------------------------------------------------------------------------------- echo -------------------------------------------------------------------------------
SYSTEM_AUTH="$auth" SYSTEM_AUTH="$auth"
test -n "$auth" -a "$auth" != "unknown" test -n "$auth" -a "$auth" != "unknown"
@ -111,13 +119,13 @@ is_system_auth_local()
check_krb5_conf_exists() check_krb5_conf_exists()
{ {
local retval=0 local retval=0
ls -l /etc/krb5.conf _command ls -l /etc/krb5.conf
KRB5_DEFAULT_REALM= KRB5_DEFAULT_REALM=
if ! test -e /etc/krb5.conf; then if ! test -e /etc/krb5.conf; then
is_system_auth_local && retval=2 || retval=1 is_system_auth_local && retval=2 || retval=1
else else
echo ------------------------------------------------------------------------------- echo -------------------------------------------------------------------------------
cat /etc/krb5.conf _command cat /etc/krb5.conf
echo ------------------------------------------------------------------------------- echo -------------------------------------------------------------------------------
KRB5_DEFAULT_REALM=$(grep "^\s*default_realm\s\+" /etc/krb5.conf | sed -e 's/^\s*default_realm\s*=\s*//' -e 's/\s*$//') KRB5_DEFAULT_REALM=$(grep "^\s*default_realm\s\+" /etc/krb5.conf | sed -e 's/^\s*default_realm\s*=\s*//' -e 's/\s*$//')
fi fi
@ -158,7 +166,7 @@ check_krb5_conf_kdc_lookup()
check_krb5_keytab_exists() check_krb5_keytab_exists()
{ {
local retval=0 local retval=0
ls -l /etc/krb5.keytab _command ls -l /etc/krb5.keytab
if ! test -e /etc/krb5.keytab; then if ! test -e /etc/krb5.keytab; then
is_system_auth_local && retval=2 || retval=1 is_system_auth_local && retval=2 || retval=1
fi fi
@ -207,8 +215,8 @@ compare_resolv_conf_with_default_realm()
_check_nameserver() _check_nameserver()
{ {
local ns="$1" local ns="$1"
if ping -c 2 -i2 "$ns"; then if _command ping -c 2 -i2 "$ns"; then
test -z "$DOMAIN_DOMAIN" || host "$DOMAIN_DOMAIN" "$ns" test -z "$DOMAIN_DOMAIN" || _command host "$DOMAIN_DOMAIN" "$ns"
fi fi
} }