4 # /etc/rc.diskless - general BOOTP startup
6 # BOOTP has mounted / for us. Assume a read-only mount. We must then
7 # - figure out where the NFS mount is coming from
8 # - figure out our IP by querying the interface
9 # - retarget /conf/ME softlink to proper configuration script directory
11 # It is expected that /etc/fstab and /etc/rc.conf.local will be
12 # set by the system operator on the server to be softlinks to
13 # /conf/ME/fstab and /conf/ME/rc.conf.local. The system operator may
14 # choose to retarget other files as well. The server itself boots
15 # properly with its default /conf/ME softlink pointing to
16 # /conf/server.host.name.
18 # During a diskless boot, we retarget the /conf/ME softlink to point
19 # to /conf/DISKLESS.CLIENT.IP.ADDRESS. Thus, various system config
20 # files that are softlinks through /conf/ME also get retargeted.
22 # SEE SAMPLE FILES IN /usr/share/examples/diskless.
26 # Routine to check for error
28 # checks error code and drops into shell on failure.
29 # if shell exits, terminates script as well as /etc/rc.
36 echo "$2 failed: dropping into /bin/sh"
47 # Figure out where the root mount is coming from, synthesize a mount
48 # for /usr and mount it.
50 # e.g. nfs_root might wind up as "A.B.C.D:/"
52 # NOTE! the /usr mount is only temporary so we can access commands necessary
53 # to retarget /conf/ME. The actual /usr mount should be part of the
54 # retargeted /etc/fstab. See instructions in /usr/share/examples/diskless.
58 mount_nfs -o ro ${nfs_root}/usr /usr
60 chkerr $? "mount of /usr"
62 # Figure out our interface and IP.
65 bootp_ifc=`route -n get default | fgrep interface | awk '{ print $2; }'`
66 bootp_ipa=`ifconfig ${bootp_ifc} | fgrep inet | head -1 | awk '{ print $2; }'`
68 echo "Interface ${bootp_ifc} IP-Address ${bootp_ipa}"
74 # MFS's background process takes a bit to startup. Various config files
75 # on server should be softlinks through /conf/ME. The server's own /conf/ME
76 # points to the server's version of the files.
78 # We retarget /conf/ME using a -o union mount. This allows
79 # us to 'mkdir' over whatever was there previously.
81 # WARNING! null mounts cannot handle mmap, and since many programs
82 # use mmap (such as 'cp'), we have to copy.
84 mount_mfs -s 256 -T qp120at -o union dummy /conf
85 chkerr $? "MFS mount on /conf"
88 cp -Rp /conf/$bootp_ipa/* /conf/ME
93 sysctl -w kern.bootfile=/conf/ME/kernel
95 # Tell /etc/rc to run the specified script after
96 # it does its mounts but before it does anything
99 # This script is responsible for setting up the
100 # diskless mount environment. This can be
101 # overriden by /conf/ME/rc.conf.local if, for
102 # example, you do not want to run the standard
103 # system /etc/rc.diskless2
105 diskless_mount="/etc/rc.diskless2"