aboutsummaryrefslogtreecommitdiff
path: root/init.d/hostname
blob: 35cf1068cb7811a0b5f4b6f4b10e6e7353af78dd (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
#!/sbin/runscript
# Copyright 1999-2007 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2

description="Sets the hostname of the machine."

depend() {
	need checkroot
}

start() {
	if [ -f /etc/hostname ] ; then
		ewarn "You should stop using /etc/hostname and use /etc/conf.d/hostname"
		HOSTNAME=$(cat /etc/hostname)
	fi

	ebegin "Setting hostname to ${HOSTNAME}"
	hostname "${HOSTNAME}"
	eend $? "Failed to set the hostname"
}

# vim: set ts=4 :