diff options
Diffstat (limited to 'openrc/hostname.initd')
-rw-r--r-- | openrc/hostname.initd | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/openrc/hostname.initd b/openrc/hostname.initd new file mode 100644 index 0000000..cf4c5ce --- /dev/null +++ b/openrc/hostname.initd @@ -0,0 +1,21 @@ +#!/sbin/openrc-run + +# Copyright (c) Natanael Copa +# This code is licensed under BSD-2-Clause + +description="Sets the hostname of the machine." + +depend() { + keyword -prefix -lxc -docker +} + +start() { + if [ -s /etc/hostname ] ; then + opts="-F /etc/hostname" + else + opts="${hostname:-localhost}" + fi + ebegin "Setting hostname" + hostname $opts + eend $? +} |