openrc/init.d/hostname.in

18 lines
377 B
Plaintext
Raw Normal View History

#!/sbin/runscript
# Copyright 2007-2008 Roy Marples <roy@marples.name>
# All rights reserved. Released under the 2-clause BSD license.
description="Sets the hostname of the machine."
2008-03-03 02:43:21 +05:30
depend() {
keyword noprefix
}
start()
{
hostname=${hostname-${HOSTNAME-localhost}}
ebegin "Setting hostname to ${hostname}"
hostname "${hostname}"
eend $? "Failed to set the hostname"
}