Add a hostname function for systems that don't have it.

Some systems don't have a hostname command (it's not required by POSIX).
The do have uname -n (which is), but as found by tim@ some others (eg
UnixWare) do not report the FQDN from uname -n.
This commit is contained in:
Darren Tucker 2021-02-06 09:37:01 +11:00
parent 5e385a71ef
commit f88a7a4312

View File

@ -323,6 +323,15 @@ md5 () {
wc -c
fi
}
# Some platforms don't have hostname at all, but on others uname -n doesn't
# provide the fully qualified name we need, so in the former case we create
# our own hostname function.
if ! have_prog hostname; then
hostname() {
uname -n
}
fi
# End of portable specific functions
stop_sshd ()