summaryrefslogtreecommitdiff
path: root/system/openrc/hostname.initd
diff options
context:
space:
mode:
Diffstat (limited to 'system/openrc/hostname.initd')
-rw-r--r--system/openrc/hostname.initd18
1 files changed, 18 insertions, 0 deletions
diff --git a/system/openrc/hostname.initd b/system/openrc/hostname.initd
new file mode 100644
index 000000000..c1580db08
--- /dev/null
+++ b/system/openrc/hostname.initd
@@ -0,0 +1,18 @@
+#!/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 $?
+}