Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 25 Jan 1999 01:02:36 -0800 (PST)
From:      Matthew Dillon <dillon@apollo.backplane.com>
To:        Luigi Rizzo <luigi@labinfo.iet.unipi.it>
Cc:        current@FreeBSD.ORG
Subject:   Re: beginnings of a diskless boot sequence being committed
Message-ID:  <199901250902.BAA02600@apollo.backplane.com>
References:   <199901250533.GAA25782@labinfo.iet.unipi.it>

next in thread | previous in thread | raw e-mail | index | archive | help
:> 
:>     Basically this consists of a bit of code in /etc/rc and, later tonight,
:>     an /etc/rc.diskless script ( a new script ).
:
:before you reinvent the wheel, have you looked at my code in
:http://www.iet.unipi.it/~luigi/diskless981113/
:
:this is sliglthly pout of date wrt what i have now (an rc.diskless
:file, which essentially contains all rc modifications that you see in
:the above web page)
:
:	cheers
:	luigi
:-----------------------------------+-------------------------------------
:  Luigi RIZZO                      .

    I was basically just cleaning up stuff I've been using for several
    months.

    Your stuff looks quite similar.

    What I propose is that a new kernel sysctl variable be added called
    'kern.conf_dir' which the kernel initially sets to nothing.

    We modify /etc/rc to detect a diskless boot ( trivial ) ... the
    rc.diskless code must run before just about anything else since
    the filesystems are all NFS read-only mounts ( and we want to be able
    to leave them that way ).

    rc.diskless figures out the IP address BOOTP assigned us and changes
    kern.conf_dir to point to /conf/$IP.

    /etc/rc.conf is then made 'smart' about where to look for rc.conf.local
    and /etc/rc is also made smart about where to look for rc.local.  
    Specifically, if someone has set kern.conf_dir, *that* is where they 
    look.

    Here is the proposed change to /etc/rc.conf ( the tail end of it ).  Rather
    then look for and source /etc/rc.conf.local, it uses kern.conf_dir.

##############################################################
### Allow local configuration override at the very end here ##
##############################################################
#
# If the kernel configuration script MIB exists, use it. 

sysctl -n kern.conf_dir > /dev/null 2>&1
if [ $? = 0 ]; then
        conf_dir=`sysctl -n kern.conf_dir`
fi

if [ "X$conf_dir" = "X" ]; then
        conf_dir=/etc   
fi

if [ -f $conf_dir/rc.conf.local ]; then
        . $conf_dir/rc.conf.local
fi 

				--------

    /etc/rc must be modified to do something similar when it is ready to
    run /etc/rc.local -- it would use ${kern.conf_dir}/rc.local instead.

    The only non-standard item is that /etc/rc needs to bypass the standard
    disk configuraton code on a diskless boot, because the fstab is the 
    server's, not the diskless workstation's.

    My proposal pretty much keeps intact the rc / rc.conf mechanism and simply
    'moves' where rc and rc.conf look for rc.local and rc.conf.local, plus
    a little additional magic to allow it to hook all the MFS filesystems
    into the system.

    Of course, then there are all the files in /conf/IPADDRESS/...  actually
    not too many, but these require a little more customization depending
    on how you like to setup your server.

    I haven't committed the whole thing yet, I would like to get feedback on
    the general idea before I do so.  But it is ready to go now.


#!/bin/sh
#	$Id: rc,v 1.170 1999/01/25 04:40:53 dillon Exp $
#	From: @(#)rc	5.27 (Berkeley) 6/5/91
#...

stty status '^T'

# Set shell to ignore SIGINT (2), but not children;
# shell catches SIGQUIT (3) and returns to single user after fsck.
trap : 2
trap : 3	# shouldn't be needed

HOME=/; export HOME
PATH=/sbin:/bin:/usr/sbin:/usr/bin:/usr/local/sbin
export PATH

# BOOTP diskless boot.  We have to run the rc file early in order to
# handle read-only NFS mounts, where the various config files
# in /etc often don't apply.  rc.diskless may terminate the rc script
# early or it may fall through, depending on the case.
#
if [ -f /etc/rc.diskless ]; then
	if [ `/sbin/sysctl -n vfs.nfs.diskless_valid` != 0 ]; then
		. /etc/rc.diskless
	fi
fi

# Configure ccd devices.
if [ "X$skip_diskconf" != "XYES" -a -f /etc/ccd.conf ]; then
	ccdconfig -C
fi

...

if [ "X$skip_diskconf" != "XYES" ]; then
	swapon -a
fi

if [  "X$skip_diskconf" != "XYES" -a $1x = autobootx ]; then
	...
else
	echo Skipping disk checks ...
fi

 ( a couple of more minor skip_diskconf checks )

   ....


# Run custom disk mounting function ( typically setup by rc.diskless )
#
if [ "X$diskless_mount_func" != "X" ]; then
        $diskless_mount_func
fi

...  normal rc continues ...

# Do traditional rc.local file if it exists. 
# 

if [ -f $conf_dir/rc.local ]; then
	echo -n 'starting local daemons:'
        sh $conf_dir/rc.local
	echo '.'
fi

				--------

To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-current" in the body of the message



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199901250902.BAA02600>