From owner-freebsd-stable Thu Oct 22 09:22:03 1998 Return-Path: Received: (from majordom@localhost) by hub.freebsd.org (8.8.8/8.8.8) id JAA16442 for freebsd-stable-outgoing; Thu, 22 Oct 1998 09:22:03 -0700 (PDT) (envelope-from owner-freebsd-stable@FreeBSD.ORG) Received: from labinfo.iet.unipi.it (labinfo.iet.unipi.it [131.114.9.5]) by hub.freebsd.org (8.8.8/8.8.8) with SMTP id JAA16329 for ; Thu, 22 Oct 1998 09:21:11 -0700 (PDT) (envelope-from luigi@labinfo.iet.unipi.it) Received: from localhost (luigi@localhost) by labinfo.iet.unipi.it (8.6.5/8.6.5) id PAA12707; Thu, 22 Oct 1998 15:23:50 +0100 From: Luigi Rizzo Message-Id: <199810221423.PAA12707@labinfo.iet.unipi.it> Subject: Request for change... To: stable@FreeBSD.ORG Date: Thu, 22 Oct 1998 15:23:50 +0100 (MET) X-Mailer: ELM [version 2.4 PL23] Content-Type: text Sender: owner-freebsd-stable@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG As part of the diskless support with shared root and usr partitions, which i have been using for years now, I need the attached changes to /etc/rc This code detects a diskless machine from having the hostname set (through bootp) when control is given to /etc/rc, and reacts appropriately (by doing some specific actions to mount a writable /var partition and populate it -- these things can be put into a separate script, e.g. rc.diskless if necessary). This is essentially a no-op for regular machines. Details are documented in http://www.iet.unipi.it/~luigi/diskless.html Do i have permission to work on this stuff for inclusion in -stable and/or -current ? [as an aside: there are many people who use similar setups for diskless support, so if someone has suggestions please go ahead] luigi --- rc Wed Jul 22 10:16:24 1998 +++ /sd0/etc/diskless/etc/rc Thu Jun 4 11:35:21 1998 @@ -1,5 +1,5 @@ #!/bin/sh -# $Id: rc,v 1.104.2.34 1998/06/04 00:20:34 mph Exp $ +# $Id: rc,v 1.104.2.33 1998/02/15 14:24:47 jkh Exp $ # From: @(#)rc 5.27 (Berkeley) 6/5/91 # System startup script run by init on autoboot @@ -27,6 +27,7 @@ ccdconfig -C fi +DISKLESS=NO swapon -a if [ $1x = autobootx ]; then @@ -68,7 +69,9 @@ # root must be read/write both for NFS diskless and for VFS LKMs before # proceeding any further. -mount -u -o rw / +# However, do not trust fstab, could be bogus +set `df -n / ` +mount -u -o rw $8 / if [ $? != 0 ]; then echo "Filesystem mount failed, startup aborted" exit 1 @@ -76,7 +79,37 @@ umount -a >/dev/null 2>&1 +if [ "`hostname`" = "" ] +then mount -a -t nonfs +else + DISKLESS=YES + echo "This is diskless host `hostname`" + # At this point see if there is a private fstab for this machine + # to replace the default one. It goes in /var/etc/fstab + mount /var # to have something writable... + mkdir /var/etc + # at this point be careful -- /etc is empty... + cp /machine/_default_/fstab /etc/fstab + if [ -f /machine/`hostname`/fstab ] + then + echo "Customizing for `hostname`" + cp /machine/`hostname`/fstab /etc/fstab + else + echo "`hostname` does not have private fstab" + fi + mount -a -t nomfs + # now populate /var. I need /usr mounted since tar calls gunzip... + (cd / ; tar --unlink -xpzf /var.tgz ) + + if [ -d /machine/`hostname` ] + then + echo "Customizing for `hostname`" + ls /machine/`hostname` + cp /machine/`hostname`/* /etc + fi +fi + if [ $? != 0 ]; then echo "Filesystem mount failed, startup aborted" exit 1 @@ -95,7 +128,7 @@ adjkerntz -i -rm -rf /var/run/* +rm -f /var/run/* # Keep a copy of the boot messages around dmesg > /var/run/dmesg.boot @@ -122,7 +155,10 @@ network_pass1 fi +if [ "$DISKLESS" != "YES" ] +then mount -a -t nfs +fi # Whack the pty perms back into shape. chmod 666 /dev/tty[pqrsPQRS]* To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-stable" in the body of the message