From anton@belle.rnoc.urc.ac.ru  Wed Oct 17 03:10:14 2001
Return-Path: <anton@belle.rnoc.urc.ac.ru>
Received: from belle.rnoc.urc.ac.ru (belle.rnoc.urc.ac.ru [193.233.85.10])
	by hub.freebsd.org (Postfix) with ESMTP id 5165837B401
	for <FreeBSD-gnats-submit@freebsd.org>; Wed, 17 Oct 2001 03:09:41 -0700 (PDT)
Received: (from anton@localhost)
	by belle.rnoc.urc.ac.ru (8.11.4/8.11.1) id f9HA8t010726;
	Wed, 17 Oct 2001 16:08:56 +0600 (YEKST)
	(envelope-from anton)
Message-Id: <200110171008.f9HA8t010726@belle.rnoc.urc.ac.ru>
Date: Wed, 17 Oct 2001 16:08:56 +0600 (YEKST)
From: Anton Voronin <anton@chelcom.ru>
Reply-To: Anton Voronin <anton@chelcom.ru>
To: FreeBSD-gnats-submit@freebsd.org
Cc:
Subject: Fixes and improvements for rc.diskless* scripts
X-Send-Pr-Version: 3.113
X-GNATS-Notify:

>Number:         31327
>Category:       conf
>Synopsis:       Fixes and improvements for rc.diskless* scripts
>Confidential:   no
>Severity:       critical
>Priority:       high
>Responsible:    freebsd-bugs
>State:          closed
>Quarter:        
>Keywords:       
>Date-Required:  
>Class:          sw-bug
>Submitter-Id:   current-users
>Arrival-Date:   Wed Oct 17 03:20:00 PDT 2001
>Closed-Date:    Fri Apr 23 07:35:57 PDT 2004
>Last-Modified:  Fri Apr 23 07:35:57 PDT 2004
>Originator:     Anton Voronin
>Release:        FreeBSD 4.3-STABLE i386
>Organization:
Southern Ural State University
>Environment:

-stable

>Description:

1. Fix for /etc/rc.diskless2 - utilities from /usr were used before mount -a
was called.
2. /etc/rc.diskless1: added configuration option "diskless_sync_pw" to take
password files from server's /etc, not from /conf/*/etc.

>How-To-Repeat:

	Try to boot diskless FreeBSD machine using FreeBSD NFS server

>Fix:

--- rc.diskless2.ORIG	Wed Oct 17 15:37:18 2001
+++ rc.diskless2	Wed Oct 17 15:37:28 2001
@@ -55,6 +55,9 @@
 echo "+++ mfs_mount of /var"
 mount_md ${varsize:=65536} /var 1
 
+mkdir /var/db	# for /var/db/mounttab updates to sucseed when doing mount -a
+mount /usr	# to access utilities in /usr
+
 echo "+++ populate /var using /etc/mtree/BSD.var.dist"
 /usr/sbin/mtree -deU -f /etc/mtree/BSD.var.dist -p /var
 
@@ -64,7 +67,7 @@
 	/usr/bin/touch $LOGFILES
 fi
 
-mount -a       # chown and chgrp are in /usr
+mount -a	# all the rest local filesystems including ones mounted under /var
 
 #
 # XXX make sure to create one dir for each printer as requested by lpd


--- rc.diskless1.ORIG	Wed Oct 17 15:37:18 2001
+++ rc.diskless1	Wed Oct 17 16:02:42 2001
@@ -93,13 +93,43 @@
 done
 echo "Interface ${bootp_ifc} IP-Address ${bootp_ipa} Broadcast ${bootp_ipbca}"
 
+# If there is a global system configuration file, suck it in.
+#
+if [ -r /etc/defaults/rc.conf ]; then
+	. /etc/defaults/rc.conf
+	source_rc_confs
+elif [ -r /etc/rc.conf ]; then
+	. /etc/rc.conf
+fi
 
-# Create an MFS /tmp to temporarily hold files from /etc until we
-# can bootstrap /etc as an MFS.
+# Sync password files with server (step 1)
+# Warning: variable sync_diskless_pw must be set via server's rc.conf.
+#
+case ${diskless_sync_pw} in
+[Yy][Ee][Ss])
+	mount_md 4096 /var 0
+	chkerr $? "MFS mount on temporary /var"
 
+	for pwfile in passwd master.passwd pwd.db spwd.db ; do
+		/bin/cp -p /etc/$pwfile /var
+	done
+        ;;
+esac
+
+# Create own /etc
+#
 mount_md 4096 /etc 0
 chkerr $? "MFS mount on /etc"
 /bin/chmod 755 /etc
+
+# Sync password files with server (step 2).
+#
+case ${diskless_sync_pw} in
+[Yy][Ee][Ss])
+	/bin/cp -p /var/* /etc
+	/sbin/umount /var
+        ;;
+esac
 
 /bin/cp -Rp /conf/default/etc/* /etc
 chkerr $? "cp /conf/default/etc to /etc MFS"
>Release-Note:
>Audit-Trail:
State-Changed-From-To: open->feedback 
State-Changed-By: dougb 
State-Changed-When: Thu Jan 23 02:31:09 PST 2003 
State-Changed-Why:  

We've done a lot of work in this area, do the more recent scripts 
work any better for you? 

http://www.freebsd.org/cgi/query-pr.cgi?pr=31327 
State-Changed-From-To: feedback->open 
State-Changed-By: dougb 
State-Changed-When: Thu Jan 23 02:35:29 PST 2003 
State-Changed-Why:  

(Changing originator e-mail address since the first one bounced) 
Do the more recent versions of these scripts work any better for you? 

http://www.freebsd.org/cgi/query-pr.cgi?pr=31327 
State-Changed-From-To: open->closed 
State-Changed-By: arved 
State-Changed-When: Fri Apr 23 07:35:06 PDT 2004 
State-Changed-Why:  
Feedback timeout. The submitter was asked for feedback by dougb one year ago 

http://www.freebsd.org/cgi/query-pr.cgi?pr=31327 
>Unformatted:
