Subject: bin/7851: some netboot conditions set hostname(1) but not $hostname
To: None <>
From: None <>
List: netbsd-bugs
Date: 06/24/1999 12:50:57
>Number:         7851
>Category:       bin
>Synopsis:       some netboot conditions set hostname(1) but not $hostname
>Confidential:   no
>Severity:       serious
>Priority:       medium
>Responsible:    bin-bug-people (Utility Bug People)
>State:          open
>Class:          sw-bug
>Submitter-Id:   net
>Arrival-Date:   Thu Jun 24 12:50:01 1999
>Originator:     Rob Windsor
Nose Pickers Anonymous
>Release:        19990621
System: NetBSD nis-build 1.4D NetBSD 1.4D (NETBOOT) #1: Fri Jun 18 16:28:41 PDT 1999 windsor@nis-build:/usr/src/sys/arch/sparc/compile/NETBOOT sparc

	Under some netboot conditions (minimal bootparams, not using dhcp),
	hostname(1) will get set, but $hostname will not, so some parts
	of /etc/netstart and /etc/rc will not operate properly.
	Also, when running with a common /, you still have to differentiate
	certain items by $hostname (such as mounting swapfile or ssh key
	file location).  Under those conditions, it is critical to have
	$hostname functional.

	There is a condition in /etc/netstart to set hostname(1) to
	$hostname.  The opposite also needs to happen for this specific

	This bug occurs in 1.3.x, 1.4, and -current.  The following patch
	should be applied to the 1.4 branch as well as the main trunk.

	Follow the directions under NetBSD/sparc diskless(8) and Ignatios'
	notes and watch $hostname not get set.

--- /etc/netstart~	Wed May 26 04:15:10 1999
+++ /etc/netstart	Thu Jun 17 14:24:12 1999
@@ -21,6 +21,9 @@
 if [ -n "$hostname" ]; then
	echo "hostname: $hostname"
	hostname $hostname
+elif [ -n "`hostname`" ]; then
+	hostname=`hostname`
+	echo "hostname: $hostname"
 # Check $domainname first, then /etc/defaultdomain, for NIS/YP domain name