Deleted Added
full compact
rc.initdiskless (75101) rc.initdiskless (75746)
1# Copyright (c) 1999 Matt Dillion
2# All rights reserved.
3#
4# Redistribution and use in source and binary forms, with or without
5# modification, are permitted provided that the following conditions
6# are met:
7# 1. Redistributions of source code must retain the above copyright
8# notice, this list of conditions and the following disclaimer.

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

17# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
18# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
19# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
20# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
21# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
22# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
23# SUCH DAMAGE.
24#
1# Copyright (c) 1999 Matt Dillion
2# All rights reserved.
3#
4# Redistribution and use in source and binary forms, with or without
5# modification, are permitted provided that the following conditions
6# are met:
7# 1. Redistributions of source code must retain the above copyright
8# notice, this list of conditions and the following disclaimer.

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

17# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
18# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
19# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
20# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
21# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
22# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
23# SUCH DAMAGE.
24#
25# $FreeBSD: head/etc/rc.initdiskless 75101 2001-04-03 00:24:01Z bsd $
25# $FreeBSD: head/etc/rc.initdiskless 75746 2001-04-20 23:10:11Z bsd $
26#
27
28#
29# /etc/rc.diskless1 - general BOOTP startup
30#
31# BOOTP has mounted / for us. Assume a read-only mount. We must then
32# - figure out our IP by querying the interface
26#
27
28#
29# /etc/rc.diskless1 - general BOOTP startup
30#
31# BOOTP has mounted / for us. Assume a read-only mount. We must then
32# - figure out our IP by querying the interface
33# - fill /conf/etc (writable) with files from /etc, and then update
34# per-machine files from /conf/*/ where * is the IP of the host,
35# the IP of the subnet, "default", or nothing.
36# - mount /conf/etc over /etc so we can see the new files.
33# - copy /etc temporarily out of the way to /tmp/etc
34# - mount /etc as an MFS
35# - repopulate /etc with the saved off copy
36# - override files in /etc with files from /conf/*/etc where
37# '*' is default, netmask of client, ip-address of client
37#
38# WARNING: i thing you should not change /etc/rc or strange things could
39# happen.
40#
41# The operator is in charge of setting /conf/*/etc/* things as appropriate.
42# Typically rc.conf and fstab need to be changed, but possibly
43# also other files such as inetd.conf etc.
44

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

82 fi
83 shift
84 done
85 if [ "${bootp_ifc}" != "" ] ; then
86 break
87 fi
88done
89echo "Interface ${bootp_ifc} IP-Address ${bootp_ipa} Broadcast ${bootp_ipbca}"
38#
39# WARNING: i thing you should not change /etc/rc or strange things could
40# happen.
41#
42# The operator is in charge of setting /conf/*/etc/* things as appropriate.
43# Typically rc.conf and fstab need to be changed, but possibly
44# also other files such as inetd.conf etc.
45

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

83 fi
84 shift
85 done
86 if [ "${bootp_ifc}" != "" ] ; then
87 break
88 fi
89done
90echo "Interface ${bootp_ifc} IP-Address ${bootp_ipa} Broadcast ${bootp_ipbca}"
90
91# Files in /etc are copied to /conf/etc which is writable. Then
92# per-machine configs from /conf/ip.address/etc are copied onto this
93# directory. First choice is using the client's IP, then the client's
94# broadcast address, then a default configuration.
95# This way we have some flexibility to handle clusters of machines
96# on separate subnets.
97#
98# WARNING! null mounts cannot handle mmap, and since many programs
99# use mmap (such as 'cp'), we have to copy.
100#
101mount_mfs -s 2048 -T qp120at dummy /conf/etc
102cp -Rp /etc/* /conf/etc
103chkerr $? "MFS mount on /conf/etc"
104
91
105# Pick up default, network-specific, and host-specific config, in that
106# order
107
92
108if [ -d /conf/default/etc/ ]; then
109 cp -Rp /conf/default/etc/* /conf/etc
110fi
93# Create an MFS /tmp to temporarily hold files from /etc until we
94# can bootstrap /etc as an MFS.
111
95
112if [ -d /conf/${bootp_ipbca} ] ; then
113 cp -Rp /conf/${bootp_ipbca}/etc/* /conf/etc
114fi
96/sbin/mount_mfs -s 4096 -T qp120at dummy /tmp
97chkerr $? "MFS mount on /tmp"
98/bin/cp -Rp /etc /tmp
99chkerr $? "cp /etc to /tmp/etc MFS"
115
100
116if [ -d /conf/${bootp_ipa} ] ; then
117 cp -Rp /conf/${bootp_ipa}/etc/* /conf/etc
118fi
101/sbin/mount_mfs -s 4096 -T qp120at dummy /etc
102chkerr $? "MFS mount on /etc"
103/bin/chmod 755 /etc
119
104
120# Make the new directory available as /etc
105/bin/cp -Rp /tmp/etc/* /etc
106chkerr $? "cp /tmp/etc to /etc MFS"
107
108rm -rf /tmp/etc
109/sbin/umount /tmp
110
111
112# Allow for override files to replace files in /etc. Use /conf/*/etc
113# to find the override files. First choice is default files that
114# always override, then files that from the directory that matches the
115# client's broadcast address, finally followed by overrides that match
116# the client's IP address.
121#
117#
122mount_null /conf/etc /etc
118# This way we have some flexibility to handle clusters of machines
119# on separate subnets.
120#
123
121
122for i in default ${bootp_ipbca} ${bootp_ipa} ; do
123 if [ -d /conf/${i}/etc ]; then
124 cp -Rp /conf/${i}/etc/* /etc
125 fi
126done
127
124# Tell /etc/rc to run the specified script after
125# it does its mounts but before it does anything
126# else.
127#
128# This script is responsible for setting up the
129# diskless mount environment. This can be
130# overriden by /conf/ME/rc.conf.local if, for
131# example, you do not want to run the standard
132# system /etc/rc.diskless2
133
134diskless_mount="/etc/rc.diskless2"
128# Tell /etc/rc to run the specified script after
129# it does its mounts but before it does anything
130# else.
131#
132# This script is responsible for setting up the
133# diskless mount environment. This can be
134# overriden by /conf/ME/rc.conf.local if, for
135# example, you do not want to run the standard
136# system /etc/rc.diskless2
137
138diskless_mount="/etc/rc.diskless2"