Add error handling to test_hostnamectl

This commit is contained in:
Evgeny Sinelnikov 2022-04-08 11:44:05 +04:00
parent 2abdafa370
commit 27e2d040ed

View File

@ -94,10 +94,12 @@ run()
check_hostnamectl()
{
local static_host="$(hostnamectl --static)"
local transient_host="$(hostname)"
_command hostnamectl
test "$static_host" = "$transient_host"
local retval=0
local static_host="$(hostnamectl --static)" || retval=1
local transient_host="$(hostname)" || retval=1
_command hostnamectl || retval=1
test "$static_host" = "$transient_host" || retval=1
return $retval
}
test_hostname()