2 # $FreeBSD: src/release/picobsd/floppy.tree/etc/rc.conf.defaults,v 1.1.2.2 2002/03/09 18:27:39 luigi Exp $
3 # $DragonFly: src/release/picobsd/floppy.tree/etc/Attic/rc.conf.defaults,v 1.2 2003/06/17 04:27:20 dillon Exp $
5 # rc.conf for picobsd. This is sourced from /etc/rc1, and is supposed to
6 # contain only shell functions that are used later in /etc/rc1.
8 # set default values for variables. Boolean values should be either
9 # NO or YES -- other values are not guaranteed to work.
11 rc_conf_set_defaults() {
12 hostname="" # Should not need to set it
15 swapfile="" # name of swapfile if aux swapfile desired.
17 # Network interface configurations: ifconfig_${interface}[_aliasNN]
18 ifconfig_lo0="inet 127.0.0.1" # default loopback device configuration.
19 #ifconfig_lo0_alias0="inet 127.0.0.254 netmask 0xffffffff" # Sample alias entry.
21 ### Network daemons options: they are only run if present.
22 sshd_enable="YES" # if present...
23 inetd_enable="YES" # Run the network daemon dispatcher (or NO)
24 inetd_flags="" # Optional flags to inetd
25 snmpd_enable="NO" # Run the SNMP daemon (or NO)
26 snmpd_flags="-C -c /etc/snmpd.conf" # Optional flags to snmpd
28 ### Network routing options: ###
29 defaultrouter="NO" # Set to default gateway (or NO).
30 static_routes="" # Set to static route list (or leave empty).
31 gateway_enable="NO" # Set to YES if this host will be a gateway.
32 arpproxy_all="" # replaces obsolete kernel option ARP_PROXYALL.
33 default_mask="0xffffff00"
35 ### Other network features
37 firewall_quiet="NO" # be quiet if set.
38 firewall_type="" # Standard types or absolute pathname.
39 tcp_extensions="NO" # Allow RFC1323 & RFC1644 extensions (or NO).
41 ### Overrides for some files in /etc. Leave empty if no override,
42 ### set variable (remember to use multiple lines) to override content.
49 # Try to identify the system by using the MAC address and name of the
50 # first ethernet interface, made available as $main_eth $main_if
53 for main_if in `ifconfig -l` ; do
54 set `ifconfig $main_if`
55 while [ "$1" != "" ] ; do
56 if [ $1 = "ether" ] ; then
66 # the following lets the user specify a name and ip for his system
68 echo "Please enter a hostname and IP address for your system $main_ether"
70 if [ "${hostname}" != "" ] ; then
71 echo "# $main_ether $hostname" >> /etc/hosts
72 echo "$the_ip $hostname" >> /etc/hosts
78 # set "ether" using $1 (interface name) as search key
84 while [ "$1" != "" ] ; do
85 if [ "$1" = "ether" ] ; then
94 # read content from /etc/hosts into a couple of arrays
95 # (needed later in fetch_hostname)
97 local i a b c key junk
99 while read a b c junk ; do
100 if [ "$a" = "#ethertable" ] ; then
102 elif [ "$i" != "" -a "$a" = "#" -a "$b" != "" ] ; then
104 eval eth_host_${i}=$c
110 # set ${hostname} using $1 (MAC address) as search key in /etc/hosts
111 # Returns empty value if $1 is empty
115 [ "$1" = "" ] && return
119 [ "${eth_0}" = "" ] && read_hosts # fill cache.
120 while [ "$b" != "" -a "${hostname}" = "" ] ; do
123 X${b} ) # so we can use wildcards
124 eval hostname=\${eth_host_${i}}
130 echo "fetch_hostname for <${key}> returns <${hostname}>"
133 # sets "mask" using $1 (netmask name) as the search key in /etc/networks
136 key=$1 # search key, typically hostname-netmask
138 while read a b junk; do # key mask otherstuff
140 X${a} ) # The X is so we can use wildcards in ${a}
146 if [ "${mask}" = "" ] ; then
149 echo "fetch_mask for <${key}> returns <${mask}>"
152 # set hostname, and ifconfig_${main_if} (whose MAC is ${main_ether})
153 # if not found, read from console
154 set_main_interface() {
155 if [ -z "${hostname}" ] ; then
156 if [ -z "${main_ether}" ] ; then
157 echo "No ethernets found, using localhost"
161 fetch_hostname ${main_ether}
164 [ -z "${hostname}" -o "${hostname}" = "." ] && read_address
166 fetch_mask ${hostname}-netmask
168 eval ifconfig_${main_if}=\" \${hostname} netmask \${mask}\"
169 network_interfaces=`ifconfig -l`
172 # set ifconfig_${interface} for all other interfaces
173 set_all_interfaces() {
174 local i ether hostname mask
176 for i in `ifconfig -l` ; do
177 if [ "$i" != "${main_if}" ] ; then
179 fetch_hostname ${ether}
180 fetch_mask ${hostname}-netmask
181 [ -n "${ether}" -a -n "${hostname}" ] && \
182 eval ifconfig_${i}=\" \${hostname} netmask \${mask}\"