hostname revision 113674
1113674Smtm#!/bin/sh
2113674Smtm#
3113674Smtm# Copyright (c) 2003 The FreeBSD Project. All rights reserved.
4113674Smtm#
5113674Smtm# Redistribution and use in source and binary forms, with or without
6113674Smtm# modification, are permitted provided that the following conditions
7113674Smtm# are met:
8113674Smtm# 1. Redistributions of source code must retain the above copyright
9113674Smtm#    notice, this list of conditions and the following disclaimer.
10113674Smtm# 2. Redistributions in binary form must reproduce the above copyright
11113674Smtm#    notice, this list of conditions and the following disclaimer in the
12113674Smtm#    documentation and/or other materials provided with the distribution.
13113674Smtm#
14113674Smtm# THIS SOFTWARE IS PROVIDED BY THE PROJECT AND CONTRIBUTORS ``AS IS'' AND
15113674Smtm# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
16113674Smtm# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
17113674Smtm# ARE DISCLAIMED.  IN NO EVENT SHALL THE PROJECT OR CONTRIBUTORS BE LIABLE
18113674Smtm# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
19113674Smtm# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
20113674Smtm# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
21113674Smtm# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
22113674Smtm# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
23113674Smtm# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
24113674Smtm# SUCH DAMAGE.
25113674Smtm#
26113674Smtm# $FreeBSD: head/etc/rc.d/hostname 113674 2003-04-18 17:51:54Z mtm $
27113674Smtm#
28113674Smtm
29113674Smtm# PROVIDE: hostname
30113674Smtm# REQUIRE: mountcritlocal sysctl tty
31113674Smtm# BEFORE:  netif
32113674Smtm# KEYWORD: FreeBSD
33113674Smtm
34113674Smtm. /etc/rc.subr
35113674Smtm
36113674Smtmname="hostname"
37113674Smtmstart_cmd="hostname_start"
38113674Smtmstop_cmd=":"
39113674Smtm
40113674Smtmhostname_start()
41113674Smtm{
42113674Smtm	# Set the host name if it is not already set
43113674Smtm	#
44113674Smtm	if [ -z "`hostname -s`" ]; then
45113674Smtm		hostname ${hostname}
46113674Smtm		echo "Setting hostname: `hostname`."
47113674Smtm	fi
48113674Smtm}
49113674Smtm
50113674Smtmload_rc_config $name
51113674Smtmrun_rc_command "$1"
52