3 # /etc/rc.diskless1 - general BOOTP startup
5 # BOOTP has mounted / for us. Assume a read-only mount. We must then
6 # - figure out our IP by querying the interface
7 # - fill /conf/etc (writable) with files from /etc, and then update
8 # per-machine files from /conf/*/ where * is the IP of the host,
9 # the IP of the subnet, "default", or nothing.
10 # - mount /conf/etc over /etc so we can see the new files.
12 # WARNING: i thing you should not change /etc/rc or strange things could
15 # The operator is in charge of setting /conf/*/etc/* things as appropriate.
16 # Typically rc.conf and fstab need to be changed, but possibly
17 # also other files such as inetd.conf etc.
21 # Routine to check for error
23 # checks error code and drops into shell on failure.
24 # if shell exits, terminates script as well as /etc/rc.
31 echo "$2 failed: dropping into /bin/sh"
42 # Figure out our interface and IP.
48 for i in ${iflist} ; do
50 while [ $# -ge 1 ] ; do
51 if [ "${bootp_ifc}" = "" -a "$1" = "inet" ] ; then
52 bootp_ifc=${i} ; bootp_ipa=${2} ; shift
54 if [ "${bootp_ipbca}" = "" -a "$1" = "broadcast" ] ; then
59 if [ "${bootp_ifc}" != "" ] ; then
63 echo "Interface ${bootp_ifc} IP-Address ${bootp_ipa} Broadcast ${bootp_ipbca}"
65 # Files in /etc are copied to /conf/etc which is writable. Then
66 # per-machine configs from /conf/ip.address/etc are copied onto this
67 # directory. First choice is using the client's IP, then the client's
68 # broadcast address, then a default configuration.
69 # This way we have some flexibility to handle clusters of machines
70 # on separate subnets.
72 # WARNING! null mounts cannot handle mmap, and since many programs
73 # use mmap (such as 'cp'), we have to copy.
75 mount_mfs -s 2048 -T qp120at dummy /conf/etc
76 cp -Rp /etc/* /conf/etc
77 chkerr $? "MFS mount on /conf/etc"
79 if [ -d /conf/${bootp_ipa} ] ; then
80 cp -Rp /conf/${bootp_ipa}/etc/* /conf/etc
81 elif [ -d /conf/${bootp_ipbca} ] ; then
82 cp -Rp /conf/${bootp_ipbca}/etc/* /conf/etc
84 cp -Rp /conf/default/etc/* /conf/etc
87 # Make the new directory available as /etc
89 mount_null /conf/etc /etc
91 # Tell /etc/rc to run the specified script after
92 # it does its mounts but before it does anything
95 # This script is responsible for setting up the
96 # diskless mount environment. This can be
97 # overriden by /conf/ME/rc.conf.local if, for
98 # example, you do not want to run the standard
99 # system /etc/rc.diskless2
101 diskless_mount="/etc/rc.diskless2"