diff options
Diffstat (limited to 'init.d/hostname')
-rwxr-xr-x | init.d/hostname | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/init.d/hostname b/init.d/hostname new file mode 100755 index 00000000..86eb989a --- /dev/null +++ b/init.d/hostname @@ -0,0 +1,20 @@ +#!/sbin/runscript +# Copyright 1999-2007 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 + +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: ts=4 : |