From owner-freebsd-stable Thu Oct 22 14:08:51 1998 Return-Path: Received: (from majordom@localhost) by hub.freebsd.org (8.8.8/8.8.8) id OAA01605 for freebsd-stable-outgoing; Thu, 22 Oct 1998 14:08:51 -0700 (PDT) (envelope-from owner-freebsd-stable@FreeBSD.ORG) Received: from dingo.cdrom.com (dingo.cdrom.com [204.216.28.145]) by hub.freebsd.org (8.8.8/8.8.8) with ESMTP id OAA01599 for ; Thu, 22 Oct 1998 14:08:50 -0700 (PDT) (envelope-from mike@dingo.cdrom.com) Received: from dingo.cdrom.com (localhost.cdrom.com [127.0.0.1]) by dingo.cdrom.com (8.9.1/8.8.8) with ESMTP id OAA00926; Thu, 22 Oct 1998 14:12:05 -0700 (PDT) (envelope-from mike@dingo.cdrom.com) Message-Id: <199810222112.OAA00926@dingo.cdrom.com> X-Mailer: exmh version 2.0.2 2/24/98 To: Luigi Rizzo cc: stable@FreeBSD.ORG Subject: Re: Request for change... In-reply-to: Your message of "Thu, 22 Oct 1998 15:23:50 BST." <199810221423.PAA12707@labinfo.iet.unipi.it> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Date: Thu, 22 Oct 1998 14:12:04 -0700 From: Mike Smith Sender: owner-freebsd-stable@FreeBSD.ORG Precedence: bulk X-Loop: FreeBSD.ORG I don't think it's suitable for general consumption, no - there is too much of your local policy embedded in this. I'd keep it local, or perhaps see if you can't come up with a generic hook mechanism that's called out very early, and do everything inside that (optional) hook. > 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 > -- \\ Sometimes you're ahead, \\ Mike Smith \\ sometimes you're behind. \\ mike@smith.net.au \\ The race is long, and in the \\ msmith@freebsd.org \\ end it's only with yourself. \\ msmith@cdrom.com To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-stable" in the body of the message