openrc/init.d/hostname.in

18 lines
389 B
Plaintext
Raw Normal View History

#!@PREFIX@/sbin/runscript
2009-05-01 19:41:40 +05:30
# Copyright (c) 2007-2009 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 -prefix -lxc
2008-03-03 02:43:21 +05:30
}
start()
{
hostname=${hostname-${HOSTNAME-localhost}}
2009-04-27 13:21:18 +05:30
ebegin "Setting hostname to $hostname"
hostname "$hostname"
eend $? "Failed to set the hostname"
}