Deleted Added
sdiff udiff text old ( 50357 ) new ( 51231 )
full compact
1#
2# /etc/rc.diskless - general BOOTP startup
3#
4# BOOTP has mounted / for us. Assume a read-only mount. We must then
5# - figure out where the NFS mount is coming from
6# - figure out our IP by querying the interface
7# - retarget /conf/ME softlink to proper configuration script directory
8#
9# It is expected that /etc/fstab and /etc/rc.conf.local will be
10# set by the system operator on the server to be softlinks to
11# /conf/ME/fstab and /conf/ME/rc.conf.local. The system operator may
12# choose to retarget other files as well. The server itself boots
13# properly with its default /conf/ME softlink pointing to
14# /conf/server.host.name.
15#
16# During a diskless boot, we retarget the /conf/ME softlink to point
17# to /conf/DISKLESS.CLIENT.IP.ADDRESS. Thus, various system config
18# files that are softlinks through /conf/ME also get retargeted.
19#
20# SEE SAMPLE FILES IN /usr/share/examples/diskless.
21
22# chkerr:
23#
24# Routine to check for error
25#
26# checks error code and drops into shell on failure.
27# if shell exits, terminates script as well as /etc/rc.
28
29chkerr() {
30 if [ $1 != 0 ]; then
31 echo "$2 failed: dropping into /bin/sh"
32 /bin/sh
33 # RESUME
34 fi
35}
36
37# DEBUGGING
38#
39set -v
40
41# Figure out where the root mount is coming from, synthesize a mount
42# for /usr and mount it.
43#
44# e.g. nfs_root might wind up as "A.B.C.D:/"
45#
46# NOTE! the /usr mount is only temporary so we can access commands necessary
47# to retarget /conf/ME. The actual /usr mount should be part of the
48# retargeted /etc/fstab. See instructions in /usr/share/examples/diskless.
49#
50set `/bin/df /`
51nfs_root=$8
52mount_nfs -o ro ${nfs_root}/usr /usr
53
54chkerr $? "mount of /usr"
55
56# Figure out our interface and IP.
57#
58
59bootp_ifc=`route -n get default | fgrep interface | awk '{ print $2; }'`
60bootp_ipa=`ifconfig ${bootp_ifc} | fgrep inet | head -1 | awk '{ print $2; }'`
61
62echo "Interface ${bootp_ifc} IP-Address ${bootp_ipa}"
63
64umount /usr

--- 4 unchanged lines hidden (view full) ---

69# on server should be softlinks through /conf/ME. The server's own /conf/ME
70# points to the server's version of the files.
71#
72# We retarget /conf/ME using a -o union mount. This allows
73# us to 'mkdir' over whatever was there previously.
74#
75# WARNING! null mounts cannot handle mmap, and since many programs
76# use mmap (such as 'cp'), we have to copy.
77
78mount_mfs -s 256 -T qp120at -o union dummy /conf
79chkerr $? "MFS mount on /conf"
80
81mkdir /conf/ME
82cp -Rp /conf/$bootp_ipa/* /conf/ME
83
84# retarget the kernel
85#
86
87sysctl -w kern.bootfile=/conf/ME/kernel
88
89# Tell /etc/rc to run the specified script after
90# it does its mounts but before it does anything
91# else.
92#
93# This script is responsible for setting up the
94# diskless mount environment. This can be
95# overriden by /conf/ME/rc.conf.local if, for
96# example, you do not want to run the standard
97# system /etc/rc.diskless2
98
99diskless_mount="/etc/rc.diskless2"