4 # rc.conf for picobsd. This is sourced from /etc/rc1, and is supposed to
5 # contain only shell functions that are used later in /etc/rc1.
7 # set default values for variables. Boolean values should be either
8 # NO or YES -- other values are not guaranteed to work.
10 rc_conf_set_defaults() {
11 hostname="" # Should not need to set it
14 swapfile="" # name of swapfile if aux swapfile desired.
16 # Network interface configurations: ifconfig_${interface}[_aliasNN]
17 ifconfig_lo0="inet 127.0.0.1" # default loopback device configuration.
18 #ifconfig_lo0_alias0="inet 127.0.0.254 netmask 0xffffffff" # Sample alias entry.
20 ### Network daemons options: they are only run if present.
21 sshd_enable="YES" # if present...
22 inetd_enable="YES" # Run the network daemon dispatcher (or NO)
23 inetd_flags="" # Optional flags to inetd
24 snmpd_enable="NO" # Run the SNMP daemon (or NO)
25 snmpd_flags="-C -c /etc/snmpd.conf" # Optional flags to snmpd
27 ### Network routing options: ###
28 defaultrouter="NO" # Set to default gateway (or NO).
29 static_routes="" # Set to static route list (or leave empty).
30 gateway_enable="NO" # Set to YES if this host will be a gateway.
31 arpproxy_all="" # replaces obsolete kernel option ARP_PROXYALL.
32 default_mask="0xffffff00"
34 ### Other network features
36 firewall_quiet="NO" # be quiet if set.
37 firewall_type="" # Standard types or absolute pathname.
38 tcp_extensions="NO" # Allow RFC1323 & RFC1644 extensions (or NO).
40 ### Overrides for some files in /etc. Leave empty if no override,
41 ### set variable (remember to use multiple lines) to override content.
48 # Try to identify the system by using the MAC address and name of the
49 # first ethernet interface, made available as $main_eth $main_if
52 for main_if in `ifconfig -l` ; do
53 set `ifconfig $main_if`
54 while [ "$1" != "" ] ; do
55 if [ $1 = "ether" ] ; then
65 # the following lets the user specify a name and ip for his system
67 echo "Please enter a hostname and IP address for your system $main_ether"
69 if [ "${hostname}" != "" ] ; then
70 echo "# $main_ether $hostname" >> /etc/hosts
71 echo "$the_ip $hostname" >> /etc/hosts
77 # set "ether" using $1 (interface name) as search key
83 while [ "$1" != "" ] ; do
84 if [ "$1" = "ether" ] ; then
93 # read content from /etc/hosts into a couple of arrays
94 # (needed later in fetch_hostname)
96 local i a b c key junk
98 while read a b c junk ; do
99 if [ "$a" = "#ethertable" ] ; then
101 elif [ "$i" != "" -a "$a" = "#" -a "$b" != "" ] ; then
103 eval eth_host_${i}=$c
109 # set ${hostname} using $1 (MAC address) as search key in /etc/hosts
110 # Returns empty value if $1 is empty
114 [ "$1" = "" ] && return
118 [ "${eth_0}" = "" ] && read_hosts # fill cache.
119 while [ "$b" != "" -a "${hostname}" = "" ] ; do
122 X${b} ) # so we can use wildcards
123 eval hostname=\${eth_host_${i}}
129 echo "fetch_hostname for <${key}> returns <${hostname}>"
132 # sets "mask" using $1 (netmask name) as the search key in /etc/networks
135 key=$1 # search key, typically hostname-netmask
137 while read a b junk; do # key mask otherstuff
139 X${a} ) # The X is so we can use wildcards in ${a}
145 if [ "${mask}" = "" ] ; then
148 echo "fetch_mask for <${key}> returns <${mask}>"
151 # set hostname, and ifconfig_${main_if} (whose MAC is ${main_ether})
152 # if not found, read from console
153 set_main_interface() {
154 if [ -z "${hostname}" ] ; then
155 if [ -z "${main_ether}" ] ; then
156 echo "No ethernets found, using localhost"
160 fetch_hostname ${main_ether}
163 [ -z "${hostname}" -o "${hostname}" = "." ] && read_address
165 fetch_mask ${hostname}-netmask
167 eval ifconfig_${main_if}=\" \${hostname} netmask \${mask}\"
168 network_interfaces=`ifconfig -l`
171 # set ifconfig_${interface} for all other interfaces
172 set_all_interfaces() {
173 local i ether hostname mask
175 for i in `ifconfig -l` ; do
176 if [ "$i" != "${main_if}" ] ; then
178 fetch_hostname ${ether}
179 fetch_mask ${hostname}-netmask
180 [ -n "${ether}" -a -n "${hostname}" ] && \
181 eval ifconfig_${i}=\" \${hostname} netmask \${mask}\"