openrc/init.d/hostname.in

18 lines
368 B
Plaintext
Raw Normal View History

#!@PREFIX@/sbin/runscript
2009-05-01 15:11:40 +01:00
# Copyright (c) 2007-2009 Roy Marples <roy@marples.name>
# Released under the 2-clause BSD license.
description="Sets the hostname of the machine."
2008-03-02 21:13:21 +00:00
depend() {
keyword -prefix -lxc
2008-03-02 21:13:21 +00:00
}
start()
{
hostname=${hostname-${HOSTNAME-localhost}}
2009-04-27 07:51:18 +00:00
ebegin "Setting hostname to $hostname"
hostname "$hostname"
eend $? "Failed to set the hostname"
}