aports/main/openrc/hostname.initd
Stuart Cardall f96d2c4446 main/openrc: fix hostname init
prevents a hostname of "?" if /etc/hostname is empty
2015-12-16 13:28:45 +00:00

19 lines
256 B
Plaintext

#!/sbin/openrc-run
description="Sets the hostname of the machine."
depend() {
keyword -prefix -lxc
}
start() {
if [ -s /etc/hostname ] ; then
opts="-F /etc/hostname"
else
opts="localhost"
fi
ebegin "Setting hostname"
hostname $opts
eend $?
}