add missing hostname file

Signed-off-by: Justin Cormack <justin.cormack@unikernel.com>
This commit is contained in:
Justin Cormack 2016-01-18 17:24:19 +00:00
parent 366973ea80
commit f8254ea4dd

View File

@ -0,0 +1,21 @@
#!/sbin/openrc-run
description="Sets the hostname of the machine."
depend() {
after 9pinit
keyword -prefix -lxc
}
start() {
opts="docker"
if cat /proc/cmdline | grep -q 'com.docker.database'
then
DATABASE="/Mac$(cat /proc/cmdline | sed -e 's/.*com.docker.database="//' -e 's/".*//')"
HOSTFILE="/Database/branch/master/ro/${DATABASE}/hostname"
[ -s ${HOSTFILE} ] && opts="-F ${HOSTFILE}"
fi
ebegin "Setting hostname"
hostname $opts
eend $?
}