Handle the case when the admin forgot to set $hostname,

which can happen in new installations: advise to set the
variable and refer to rc.conf(5).
This commit is contained in:
Yaroslav Tykhiy 2007-02-10 13:13:32 +00:00
parent 31a9460383
commit aad85353cc

View File

@ -58,7 +58,16 @@ hostname_start()
fi
fi
/bin/hostname ${hostname}
# Have we got a hostname yet?
#
if [ -z "${hostname}" ]; then
warn "\$hostname is not set -- see ${rcvar_manpage}."
return
fi
# All right, it is safe to invoke hostname(1) now.
#
/bin/hostname "${hostname}"
echo "Setting hostname: `hostname`."
}