freebsd-dev/release/picobsd/floppy.tree/etc/rc1
Luigi Rizzo 4323f7b024 Fix handling of undefined variables.
Add override for /etc/rc.local .
Add hook to start syslogd if compiled-in and /etc/syslog.conf exists
2002-04-07 20:41:09 +00:00

62 lines
1.8 KiB
Bash

#!/bin/sh
# $FreeBSD$
### rc1, next stage 'rc' for PicoBSD -- THIS IS NOT THE NORMAL /etc/rc
. /etc/rc.conf.defaults # Load default procedures
rc_conf_set_defaults # Assign default values to variables.
find_system_id # Set $main_eth $main_if
set_main_interface # Set ${hostname} and ${ifconfig_${main_if}}
set_all_interfaces # Set ${ifconfig_${if}} for other interfaces.
# Now process local configurations if present. ${hostname} should be set now,
# so rc.conf[.local] can make use of a case statement to set per-host things.
[ -f /etc/rc.conf ] && . /etc/rc.conf
[ -f /etc/rc.conf.local ] && . /etc/rc.conf.local
### Now use some variables to override files in /etc ###
( IFS=''
[ -n "${host_conf}" ] && echo ${host_conf} > /etc/host.conf
[ -n "${resolv_conf}" ] && echo ${resolv_conf} > /etc/resolv.conf
[ -n "${rc_local}" ] && echo ${rc_local} > /etc/rc.local
unset IFS
)
rm -f /var/run/*
if [ "x$swapfile" != "xNO" -a -w "$swapfile" -a -b /dev/vn0b ]; then
echo "Adding $swapfile as additional swap."
vnconfig /dev/vn0b $swapfile && swapon /dev/vn0b
else
echo "No swap partition available!"
fi
# configure serial devices
[ -f /etc/rc.serial ] && . /etc/rc.serial
# start up the initial network configuration.
if [ -f /etc/rc.network ]; then
. /etc/rc.network
network_pass1
fi
mount -a -t nfs
# clean up left-over files
(cd /var/run && { cp /dev/null utmp; chmod 644 utmp; })
[ -n "$network_pass1_done" ] && network_pass2
[ -n "$network_pass2_done" ] && network_pass3
[ -f /etc/syslog.conf -a -f /stand/syslogd ] && \
{ echo "Starting syslogd."; syslogd ${syslogd_flags} ; }
[ "${inetd_enable}" = "YES" -a -f /stand/inetd ] && \
{ echo "Starting inetd."; inetd ${inetd_flags} ; }
[ "${sshd_enable}" = "YES" -a -f /stand/sshd ] && \
{ echo "Starting sshd..." ; sshd -f /etc/sshd_config ; }
pwd_mkdb -p ./master.passwd
dev_mkdb
echo ''
cat /etc/motd
exit 0