identity-node revision 7c478bd95313f5f23a4c958a745db2134aa03244
0N/A#!/sbin/sh
0N/A#
0N/A# CDDL HEADER START
0N/A#
0N/A# The contents of this file are subject to the terms of the
0N/A# Common Development and Distribution License, Version 1.0 only
0N/A# (the "License"). You may not use this file except in compliance
0N/A# with the License.
0N/A#
0N/A# You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
0N/A# or http://www.opensolaris.org/os/licensing.
0N/A# See the License for the specific language governing permissions
0N/A# and limitations under the License.
0N/A#
0N/A# When distributing Covered Code, include this CDDL HEADER in each
0N/A# file and include the License file at usr/src/OPENSOLARIS.LICENSE.
0N/A# If applicable, add the following below this CDDL HEADER, with the
0N/A# fields enclosed by brackets "[]" replaced with your own identifying
0N/A# information: Portions Copyright [yyyy] [name of copyright owner]
0N/A#
0N/A# CDDL HEADER END
0N/A#
0N/A#
0N/A# Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T.
0N/A# All rights reserved.
0N/A#
0N/A#
0N/A# Copyright 2004 Sun Microsystems, Inc. All rights reserved.
58N/A# Use is subject to license terms.
58N/A#
0N/A# ident "%Z%%M% %I% %E% SMI"
0N/A
0N/A. /lib/svc/share/smf_include.sh
0N/A. /lib/svc/share/net_include.sh
0N/A
0N/A# Make sure that the libraries essential to this stage of booting can be found.
0N/ALD_LIBRARY_PATH=/lib; export LD_LIBRARY_PATH
58N/A
58N/A#
58N/A# If DHCP was used on a primary interface then set the hostname
0N/A# that was returned. If no hostname was returned, set the name
0N/A# to be "unknown". The hostname must be set to something, because
0N/A# tooltalk will hang unless the name can be locally resolved.
50N/A# Sendmail also requires the name to be resolvable locally.
0N/A# Later, in inetsvc, we create a name "unknown" and create a entry
93N/A# in the local /etc/inet/hosts file pairing "unknown" with the IP
93N/A# address assigned by DHCP. The use of bootparams as a fallback
0N/A# for all non-DHCP cases provides compatibility with the
0N/A# behavior of the system before netstrategy was introduced.
0N/A#
0N/A# For non-global zones, fall back to the `uname -n` value provided by the
0N/A# kernel if /etc/nodename does not exist, as is expected on an initial boot.
80N/A#
0N/A
50N/Asmf_netstrategy
47N/A
0N/Acase "$_INIT_NET_STRATEGY" in
0N/A "dhcp") hostname=`/sbin/dhcpinfo Hostname` ;;
0N/A "rarp") hostname=`/sbin/hostconfig -h -p bootparams`
27N/A trap 'intr=1' 2 3
0N/A while [ -z "$hostname" -a ! -f /etc/.UNCONFIGURED -a \
0N/A -z "$intr" ]; do
0N/A echo "re-trying host configuration..."
0N/A # Restrict this to IPv4 interfaces.
0N/A /sbin/ifconfig -adD4 auto-revarp up
0N/A hostname=`/sbin/hostconfig -h -p bootparams`
0N/A done
0N/A trap 2 3 ;;
0N/A "none") hostname="`shcat /etc/nodename 2>/dev/null`"
0N/A if [ -z "$hostname" ]; then
0N/A if [ "${_INIT_ZONENAME:=`/sbin/zonename`}" = "global" ]
0N/A then
27N/A hostname=`/sbin/hostconfig -h -p bootparams`
0N/A else
0N/A hostname=`/sbin/uname -n`
0N/A fi
50N/A fi ;;
50N/Aesac
50N/A
0N/A#
0N/A# If the netstrategy was unsuccessful and we haven't got a locally configured
0N/A# name, default to "unknown"
0N/A#
0N/Aif [ -z "$hostname" ]; then
0N/A hostname="`shcat /etc/nodename 2>/dev/null`"
0N/A if [ -z "$hostname" ]; then
0N/A hostname="unknown"
0N/A fi
0N/Afi
0N/A
0N/A/sbin/uname -S $hostname
0N/A
0N/Aecho "Hostname: `/sbin/uname -n`" > /dev/msglog
0N/A
0N/A# Reset the library path now that we are past the critical stage
0N/Aunset LD_LIBRARY_PATH
0N/A