2021-02-23 19:03:01 +00:00
|
|
|
#! /bin/bash
|
|
|
|
|
|
|
|
function check
|
|
|
|
{
|
|
|
|
_notify 'tasklog' 'Checking configuration'
|
|
|
|
for FUNC in "${FUNCS_CHECK[@]}"
|
|
|
|
do
|
|
|
|
${FUNC} || _defunc
|
|
|
|
done
|
|
|
|
}
|
|
|
|
|
|
|
|
function _check_hostname
|
|
|
|
{
|
|
|
|
_notify 'task' 'Checking that hostname/domainname is provided or overridden'
|
|
|
|
|
|
|
|
if [[ -n ${OVERRIDE_HOSTNAME} ]]
|
|
|
|
then
|
|
|
|
export HOSTNAME=${OVERRIDE_HOSTNAME}
|
|
|
|
export DOMAINNAME="${HOSTNAME#*.}"
|
|
|
|
fi
|
|
|
|
|
|
|
|
_notify 'inf' "Domain has been set to ${DOMAINNAME}"
|
|
|
|
_notify 'inf' "Hostname has been set to ${HOSTNAME}"
|
|
|
|
|
|
|
|
if ! grep -q -E '^(\S+[.]\S+)$' <<< "${HOSTNAME}"
|
|
|
|
then
|
|
|
|
_notify 'err' 'Setting hostname/domainname is required'
|
2021-06-19 20:24:06 +00:00
|
|
|
_shutdown
|
2021-02-23 19:03:01 +00:00
|
|
|
return 1
|
|
|
|
fi
|
|
|
|
}
|