diff options
author | luigi <luigi@FreeBSD.org> | 2002-03-08 05:15:08 +0000 |
---|---|---|
committer | luigi <luigi@FreeBSD.org> | 2002-03-08 05:15:08 +0000 |
commit | 6b229a1455c9cd14021328f87387a7c0532f3518 (patch) | |
tree | 506f66a3786a1893b9abda8f1b8fb30b4dd58932 /release/picobsd/mfs_tree/etc | |
parent | fa65eefffdeccf45bd61757c1bdc59d175666493 (diff) | |
download | FreeBSD-src-6b229a1455c9cd14021328f87387a7c0532f3518.zip FreeBSD-src-6b229a1455c9cd14021328f87387a7c0532f3518.tar.gz |
Major cleanup of PicoBSD startup scripts, which now should be
closer to doing "the right thing".
The structure is now the following:
* /etc/rc (from MFS) loads the rest of /etc and /root from
/fd and then from floppy (if present), then transfers control
to /etc/rc1
* /etc/rc1 loads defaults from /etc/rc.conf.defaults, tries to
set the hostname basing on the MAC address of the first ethernet
interface, and then sources /etc/rc.conf and /etc/rc.conf.local
for local configurations
* The rest of the startup process is then performed (rc.network and so on).
Everything except the initial /etc/rc (from MFS) can be overridden with
a local version loaded from floppy. But in most cases, you should only need
to customize the following files in /etc:
rc.conf rc.firewall hosts
Previously there were a number of inconsistencies in the calling
between files, and also a lot of clutter in rc.conf and rc.firewall.
Also, "rc1" was called "rc" and would overwrite the initial /etc/rc
from MFS, making it really hard to figure out what was going on in
case of bugs.
Diffstat (limited to 'release/picobsd/mfs_tree/etc')
-rw-r--r-- | release/picobsd/mfs_tree/etc/rc | 28 | ||||
-rw-r--r-- | release/picobsd/mfs_tree/etc/rc.network | 86 |
2 files changed, 53 insertions, 61 deletions
diff --git a/release/picobsd/mfs_tree/etc/rc b/release/picobsd/mfs_tree/etc/rc index ae55787..e59af75 100644 --- a/release/picobsd/mfs_tree/etc/rc +++ b/release/picobsd/mfs_tree/etc/rc @@ -1,36 +1,24 @@ #!/bin/sh -# $FreeBSD$ -### Special setup for one floppy PICOBSD ### -# WARNING !!! We overwrite this file during execution with a new rc file. -# Awful things happen if this file's size is > 1024B stty status '^T' trap : 2 trap : 3 HOME=/; export HOME -PATH=/sbin:/bin:/usr/sbin:/usr/bin:/usr/local/sbin -export PATH +PATH=/sbin:/bin:/usr/sbin:/usr/bin; export PATH dev="/dev/fd0" -cp -p /etc/rc /etc/rc.master trap "echo 'Reboot interrupted'; exit 1" 3 -echo "Reading from MFS ..." -cd /fd; cp -Rp etc root / ; cd / -ls /dev -echo "Reading /etc from ${dev}..." -mount -o rdonly ${dev} /fd -cd /fd; cp -Rp etc root / ; cd / ; umount /fd +echo "Loading /etc from MFS:/fd ..." +cp -Rp /fd/* / +echo "Updating /etc from ${dev}..." +mount -o rdonly ${dev} /fd && \ +{ cd /fd; cp -Rp etc root / ; cd / ; umount /fd ; } cd /etc #rm files to stop overwrite warning for i in *; do - if [ -f $i.gz ]; then - rm $i - fi + [ -f $i.gz ] && rm $i done gzip -d *.gz -pwd_mkdb -p ./master.passwd -echo "Ok. (Now you can remove ${dev} if you like)" -echo "" -. rc +. rc1 exit 0 diff --git a/release/picobsd/mfs_tree/etc/rc.network b/release/picobsd/mfs_tree/etc/rc.network index 235db0a..d7ec035 100644 --- a/release/picobsd/mfs_tree/etc/rc.network +++ b/release/picobsd/mfs_tree/etc/rc.network @@ -1,70 +1,74 @@ #!/bin/sh - # $FreeBSD$ + network_pass1() { echo -n 'Doing initial network setup:' # Set the host name if it is not already set if [ -z "`hostname -s`" ] ; then - hostname $hostname - echo ' hostname' + hostname $hostname + echo ' hostname' fi # Set up all the network interfaces, calling startup scripts if needed for ifn in ${network_interfaces}; do - if [ -e /etc/start_if.${ifn} ]; then - . /etc/start_if.${ifn} - fi - # Do the primary ifconfig if specified - eval ifconfig_args=\$ifconfig_${ifn} - if [ -n "${ifconfig_args}" ] ; then - ifconfig ${ifn} ${ifconfig_args} + [ -e /etc/start_if.${ifn} ] && . /etc/start_if.${ifn} + # Do the primary ifconfig if specified + eval ifconfig_args=\$ifconfig_${ifn} + [ -n "${ifconfig_args}" ] && ifconfig ${ifn} ${ifconfig_args} + # Check to see if aliases need to be added + alias=0 + while : + do + eval ifconfig_args=\$ifconfig_${ifn}_alias${alias} + if [ -n "${ifconfig_args}" ]; then + ifconfig ${ifn} ${ifconfig_args} alias + alias=`expr ${alias} + 1` + else + break; fi - # Check to see if aliases need to be added - alias=0 - while : - do - eval ifconfig_args=\$ifconfig_${ifn}_alias${alias} - if [ -n "${ifconfig_args}" ]; then - ifconfig ${ifn} ${ifconfig_args} alias - alias=`expr ${alias} + 1` - else - break; - fi - done - ifconfig ${ifn} + done + ifconfig ${ifn} done # Load the filters if required - if [ -n "$firewall_enable" -a -f /etc/rc.firewall -a \ - "x$firewall_enable" = "xYES" ] ; then - . /etc/rc.firewall - echo "Firewall rules loaded." + if [ -f /etc/rc.firewall -a "${firewall_enable}" = "YES" ] ; then + # Set quiet mode if requested + if [ "${firewall_quiet}" = "YES" ]; then + fwcmd="/sbin/ipfw -q" + else + fwcmd="/sbin/ipfw" + fi + $fwcmd -f flush # Flush out the list before we begin. + + . /etc/rc.firewall + echo "Firewall rules loaded." else - echo "Warning: kernel has firewall functionality, but firewall rules weren't loaded." - echo " All ip services are ENABLED by default." + echo "Warning: kernel has firewall functionality, but firewall rules weren't loaded." + echo " All ip services are ENABLED by default." fi # Configure routing if [ "x$defaultrouter" != "xNO" ] ; then - static_routes="default ${static_routes}" - route_default="default ${defaultrouter}" + static_routes="default ${static_routes}" + route_default="default ${defaultrouter}" fi # Set up any static routes. This should be done before router discovery. if [ "x${static_routes}" != "x" ]; then - for i in ${static_routes}; do - eval route_args=\$route_${i} - route add ${route_args} - done + for i in ${static_routes}; do + eval route_args=\$route_${i} + route add ${route_args} + done fi echo -n 'Additional routing options:' if [ -n "$tcp_extensions" -a "x$tcp_extensions" != "xYES" ] ; then - echo -n ' tcp_extensions=NO' - sysctl -w net.inet.tcp.rfc1323=0 >/dev/null 2>&1 - sysctl -w net.inet.tcp.rfc1644=0 >/dev/null 2>&1 + echo -n ' tcp_extensions=NO' + sysctl -w net.inet.tcp.rfc1323=0 >/dev/null 2>&1 + sysctl -w net.inet.tcp.rfc1644=0 >/dev/null 2>&1 fi if [ "X$gateway_enable" = X"YES" ]; then - echo -n ' IP_gateway=YES' - sysctl -w net.inet.ip.forwarding=1 >/dev/null 2>&1 + echo -n ' IP_gateway=YES' + sysctl -w net.inet.ip.forwarding=1 >/dev/null 2>&1 fi if [ "X$arpproxy_all" = X"YES" ]; then - echo -n ' turning on ARP_PROXY_ALL: ' - sysctl -w net.link.ether.inet.proxyall=1 2>&1 + echo -n ' turning on ARP_PROXY_ALL: ' + sysctl -w net.link.ether.inet.proxyall=1 2>&1 fi echo '.' network_pass1_done=YES # Let future generations know we made it. |