Per previous announcement, remove the old version of the rc system.

All functionality from the previous system has been preserved, and
users should still customize their system boot with the familiar
methods, rc.conf, rc.conf.local, rc.firewall, sysctl.conf, etc.

Users who have customized versions of scripts that have been removed
should take great care when upgrading, since the compatibility code
that used those old scripts has also been removed.
This commit is contained in:
Doug Barton 2003-05-02 05:27:35 +00:00
parent 516b02faf7
commit 4b065e2ce1
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=114492
22 changed files with 26 additions and 4023 deletions

View File

@ -17,11 +17,14 @@ NOTE TO PEOPLE WHO THINK THAT 5.0-CURRENT IS SLOW:
developers choose to disable these features on build machines
to maximize performance.
20030427:
The old rc system will soon be going away. If you have specified
rc_ng="NO" in your /etc/rc.conf[.local] you should remove it and
test with the new rc system. Please report any problems to
freebsd-rc@yahoogroups.com, and/or freebsd-current@freebsd.org.
20030501:
The old rc system has been removed. Please report any problems
to freebsd-rc@yahoogroups.com, and/or freebsd-current@freebsd.org.
Your personal versions of these files will not be removed, so you can
continue to use them. However, you should take great care when updating,
especially when using mergemaster, since the compatibility code that
utilizes these old scripts has also been removed.
20030423:
A bug has been fixed in /dev/devctl which would cause devd

View File

@ -12,20 +12,14 @@ BIN1= amd.map apmd.conf auth.conf \
inetd.conf login.access login.conf \
mac.conf motd netconfig network.subr networks newsyslog.conf \
phones printcap profile protocols \
rc rc.atm rc.devfs rc.diskless1 rc.diskless2 rc.firewall rc.firewall6 \
rc.network rc.network6 rc.pccard rc.sendmail rc.serial rc.shutdown \
rc.subr rc.syscons rc.sysctl remote rpc services \
rc rc.firewall rc.firewall6 rc.shutdown \
rc.subr remote rpc services \
shells sysctl.conf syslog.conf usbd.conf \
etc.${MACHINE_ARCH}/rc.${MACHINE_ARCH} \
etc.${MACHINE_ARCH}/ttys \
${.CURDIR}/../gnu/usr.bin/man/manpath/manpath.config \
${.CURDIR}/../usr.bin/mail/misc/mail.rc \
${.CURDIR}/../usr.bin/locate/locate/locate.rc
.if !defined(NO_I4B)
BIN1+= rc.isdn
.endif
.if exists(${.CURDIR}/../crypto) && !defined(NO_OPENSSL)
.if !defined(NO_OPENSSH)
SSH= ${.CURDIR}/../crypto/openssh/ssh_config \

View File

@ -19,7 +19,6 @@
### Important initial Boot-time options ####################
##############################################################
rc_ng="YES" # Set to NO to disable new-style rc scripts.
rc_debug="NO" # Set to YES to enable debugging output from rc.d
rc_info="YES" # Enables display of informational messages at boot.
rcshutdown_timeout="30" # Seconds to wait before terminating rc.shutdown

View File

@ -1,28 +0,0 @@
#!/bin/sh -
#
# $FreeBSD$
# Do alpha specific processing
#
echo -n 'Initial rc.alpha initialization:'
# Start the Alpha OSF/1 binary compatibility if requested.
#
case ${osf1_enable} in
[Yy][Ee][Ss])
echo -n ' OSF/1'
if ! kldstat -v | grep osf1_ecoff > /dev/null; then
kldload osf1 > /dev/null 2>&1
fi
;;
esac
# knob for wether or not we should print out unaligned access warnings
#
case ${unaligned_print} in
[Nn][Oo])
sysctl machdep.unaligned_print=0
;;
esac
echo '.'

View File

@ -1,48 +0,0 @@
#!/bin/sh -
#
# $FreeBSD$
# Do i386 specific processing
#
echo -n 'Initial rc.i386 initialization:'
case ${apm_enable} in
[Yy][Ee][Ss])
echo -n ' apm'
apm -e enable > /dev/null 2>&1
APM_DONE=yes
;;
esac
case ${apmd_enable} in
[Yy][Ee][Ss])
case ${APM_DONE} in
'')
echo -n ' apm'
apm -e enable > /dev/null 2>&1
;;
esac
echo -n ' apmd'; apmd ${apmd_flags}
;;
esac
# Start the SCO binary emulation if requested.
#
case ${ibcs2_enable} in
[Yy][Ee][Ss])
echo -n ' ibcs2'
kldload ibcs2 > /dev/null 2>&1
case ${ibcs2_loaders} in
[Nn][Oo])
;;
*)
for i in ${ibcs2_loaders}; do
kldload ibcs2_$i > /dev/null 2>&1
done
;;
esac
;;
esac
echo '.'

View File

@ -1,48 +0,0 @@
#!/bin/sh -
#
# $FreeBSD$
# Do i386 specific processing
#
echo -n 'Initial rc.i386 initialization:'
case ${apm_enable} in
[Yy][Ee][Ss])
echo -n ' apm'
apm -e enable > /dev/null 2>&1
APM_DONE=yes
;;
esac
case ${apmd_enable} in
[Yy][Ee][Ss])
case ${APM_DONE} in
'')
echo -n ' apm'
apm -e enable > /dev/null 2>&1
;;
esac
echo -n ' apmd'; apmd ${apmd_flags}
;;
esac
# Start the SCO binary emulation if requested.
#
case ${ibcs2_enable} in
[Yy][Ee][Ss])
echo -n ' ibcs2'
kldload ibcs2 > /dev/null 2>&1
case ${ibcs2_loaders} in
[Nn][Oo])
;;
*)
for i in ${ibcs2_loaders}; do
kldload ibcs2_$i > /dev/null 2>&1
done
;;
esac
;;
esac
echo '.'

View File

@ -1,17 +0,0 @@
#!/bin/sh -
#
# $FreeBSD$
# Do ia64 specific processing
#
echo -n 'Initial rc.ia64 initialization:'
# knob for wether or not we should print out unaligned access warnings
#
case ${unaligned_print} in
[Nn][Oo])
sysctl machdep.unaligned_print=0
;;
esac
echo '.'

View File

@ -1,9 +0,0 @@
#!/bin/sh -
#
# $FreeBSD$
# Do sparc64 specific processing
#
echo -n 'Initial rc.sparc64 initialization:'
echo '.'

975
etc/rc
View File

@ -50,973 +50,28 @@ HOME=/
PATH=/sbin:/bin:/usr/sbin:/usr/bin
export HOME PATH
# check_rcng() is run in a subshell solely to determine the
# RCNG mode. We do not want to pollute our variable space
# too soon so the procedure must be run in a subshell. An
# exit code of 3 indicates RCNG is enabled.
. /etc/rc.subr
# Note: the system configuration files are loaded as part of
# the RCNG system (rc.d/rccond). Do not load them here as it may
# interfere with diskless booting.
#
check_rcng()
{
if [ -r /etc/defaults/rc.conf ]; then
. /etc/defaults/rc.conf
source_rc_confs
elif [ -r /etc/rc.conf ]; then
. /etc/rc.conf
fi
# Diskless setups have to depend on a different mechanism since
# their config files haven't been retargeted yet.
#
[ -e /.rcng_yes ] && rc_ng="YES"
case ${rc_ng} in
[Yy][Ee][Ss])
exit 3
;;
*)
exit 0
;;
esac
}
( check_rcng )
if [ $? = 3 ]; then
rc_ng=YES
if [ "$1" = autoboot ]; then
autoboot=yes
_boot="faststart"
rc_fast=yes # run_rc_command(): do fast booting
else
rc_ng=NO
echo -n  ; sleep 1 ; echo -n  ; sleep 1 ; echo -n 
echo ''
echo '**** The old versions of the rc scripts are deprecated, and'
echo ' will soon be removed. Make sure to update /etc and'
echo ' check that rc_ng is YES in /etc/defaults/rc.conf.'
echo ' Please report any rc problems to freebsd-rc@yahoogroups.com'
echo ' and/or freebsd-current@freebsd.org.'
echo ''
sleep 3
autoboot=no
_boot="start"
fi
case ${rc_ng} in
YES)
. /etc/rc.subr
os=`eval ${CMD_OSTYPE}`
files=`rcorder -k ${os} -s nostart /etc/rc.d/* 2>/dev/null`
# Note: the system configuration files are loaded as part of
# the RCNG system (rc.d/rccond). Do not load them here as it may
# interfere with diskless booting.
#
if [ "$1" = autoboot ]; then
autoboot=yes
_boot="faststart"
rc_fast=yes # run_rc_command(): do fast booting
else
autoboot=no
_boot="start"
fi
os=`eval ${CMD_OSTYPE}`
files=`rcorder -k ${os} -s nostart /etc/rc.d/* 2>/dev/null`
for _rc_elem in ${files}; do
run_rc_script ${_rc_elem} ${_boot}
done
echo ''
date
exit 0
;;
*)
# fall-through to the old rc scripts
;;
esac
bootmode=$1
# BOOTP diskless boot. We have to run the rc file early in order to
# retarget various config files.
#
if [ -r /etc/rc.diskless1 ]; then
dlv=`/sbin/sysctl -n vfs.nfs.diskless_valid 2> /dev/null`
if [ ${dlv:=0} != 0 ]; then
. /etc/rc.diskless1
fi
fi
# If there is a global system configuration file, suck it in.
#
if [ -r /etc/defaults/rc.conf ]; then
. /etc/defaults/rc.conf
source_rc_confs
elif [ -r /etc/rc.conf ]; then
. /etc/rc.conf
fi
# XXX - Deprecated variable name support
# for rpcbind and ntpd
#
[ -n "$portmap_enable" ] && rpcbind_enable="$portmap_enable"
[ -n "$portmap_program" ] && rpcbind_program="$portmap_program"
[ -n "$portmap_flags" ] && rpcbind_flags="$portmap_flags"
[ -n "$single_mountd_enable" ] && mountd_enable="$single_mountd_enable"
[ -n "$xntpd_enable" ] && ntpd_enable="$xntpd_enable"
[ -n "$xntpd_program" ] && ntpd_program="$xntpd_program"
[ -n "$xntpd_flags" ] && ntpd_flags="$xntpd_flags"
feed_dev_random() {
if [ -f "${1}" -a -r "${1}" -a -s "${1}" ]; then
# echo "Using ${1} as an entropy file"
cat "${1}" | dd of=/dev/random bs=8k 2>/dev/null
fi
}
chkdepend() {
svc=$1
svc_var=$2
dep=$3
dep_var=$4
eval svc_val=\${$svc_var}
eval dep_val=\${$dep_var}
case ${svc_val} in
[Yy][Ee][Ss])
case ${dep_val} in
[Yy][Ee][Ss])
;;
*)
eval ${dep_var}="YES"
echo "DEPENDENCY NOTE: ${dep} will be enabled" \
"to support ${svc}"
;;
esac
;;
esac
}
chkdepend amd amd_enable rpcbind rpcbind_enable
chkdepend amd amd_enable NFS nfs_client_enable
chkdepend NFS nfs_server_enable rpcbind rpcbind_enable
chkdepend NIS nis_server_enable rpcbind rpcbind_enable
chkdepend NIS nis_client_enable rpcbind rpcbind_enable
# Enable dumpdev early so that a crash during the boot process can be caught.
#
case ${dumpdev} in
[Nn][Oo] | '')
dumpdev='NO'
;;
*)
/sbin/dumpon -v ${dumpdev}
;;
esac
# Enable harvesting of entropy via devices. The sooner this happens the
# better so that we can take advantage of the boot process.
#
echo -n 'Entropy harvesting:'
case ${harvest_interrupt} in
[Nn][Oo])
;;
*)
if [ -w /dev/random ]; then
/sbin/sysctl kern.random.sys.harvest.interrupt=1 >/dev/null
echo -n ' interrupts'
fi
;;
esac
case ${harvest_ethernet} in
[Nn][Oo])
;;
*)
if [ -w /dev/random ]; then
/sbin/sysctl kern.random.sys.harvest.ethernet=1 >/dev/null
echo -n ' ethernet'
fi
;;
esac
case ${harvest_p_to_p} in
[Nn][Oo])
;;
*)
if [ -w /dev/random ]; then
/sbin/sysctl kern.random.sys.harvest.point_to_point=1 >/dev/null
echo -n ' point_to_point'
fi
;;
esac
echo '.'
# First pass at reseeding /dev/random.
#
case ${entropy_file} in
[Nn][Oo] | '')
;;
*)
if [ -w /dev/random ]; then
feed_dev_random "${entropy_file}"
fi
;;
esac
# XXX temporary until we can get the entropy
# harvesting rate up
# Entropy below is not great,
# but better than nothing.
( ps -fauxww; sysctl -a; date; df -ib; dmesg; ps -fauxww; ) \
| dd of=/dev/random bs=8k 2>/dev/null
cat /bin/ls | dd of=/dev/random bs=8k 2>/dev/null
# Configure ccd devices.
#
if [ -r /etc/ccd.conf ]; then
ccdconfig -C
fi
case ${start_vinum} in
[Yy][Ee][Ss])
vinum start
;;
esac
swapon -a
# Last chance to do things before potentially waiting for
# operator to do fsck related tasks
if [ -r /etc/rc.early ]; then
. /etc/rc.early
fi
case ${bootmode} in
autoboot)
echo 'Automatic boot in progress...'
case ${background_fsck} in
[Yy][Ee][Ss])
fsck -F -p
;;
*)
fsck -p
;;
esac
case $? in
0)
;;
2)
exit 1
;;
4)
reboot
echo 'Reboot failed... help!'
exit 1
;;
8)
case ${fsck_y_enable} in
[Yy][Ee][Ss])
echo 'File system preen failed, trying fsck -y . . .'
fsck -y
case $? in
0)
;;
*)
echo 'Automatic filesystem check failed . . . help!'
exit 1
;;
esac
;;
*)
echo 'Automatic filesystem check failed . . . help!'
exit 1
;;
esac
;;
12)
echo 'Reboot interrupted'
exit 1
;;
130)
# interrupt before catcher installed
exit 1
;;
*)
echo 'Unknown error in reboot'
exit 1
;;
esac
;;
*)
echo 'Skipping disk checks ...'
;;
esac
set -T
trap "echo 'Reboot interrupted'; exit 1" 3
# root normally must be read/write, but if this is a BOOTP NFS
# diskless boot it does not have to be.
#
case ${root_rw_mount} in
[Nn][Oo] | '')
;;
*)
if ! mount -u -o rw / ; then
echo 'Mounting root filesystem rw failed, startup aborted'
exit 1
fi
;;
esac
umount -a >/dev/null 2>&1
# Set up the list of network filesystem types for which mounting should be
# delayed until after network initialization.
networkfs_types='nfs:NFS smbfs:SMB portalfs:PORTAL'
case ${extra_netfs_types} in
[Nn][Oo])
;;
*)
networkfs_types="${networkfs_types} ${extra_netfs_types}"
;;
esac
# Mount everything except nfs filesystems.
mount_excludes='no'
for i in ${networkfs_types}; do
fstype=${i%:*}
mount_excludes="${mount_excludes}${fstype},"
for _rc_elem in ${files}; do
run_rc_script ${_rc_elem} ${_boot}
done
mount_excludes=${mount_excludes%,}
mount -a -t ${mount_excludes}
case $? in
0)
;;
*)
echo 'Mounting /etc/fstab filesystems failed, startup aborted'
exit 1
;;
esac
# Run custom disk mounting function here
#
if [ -n "${diskless_mount}" -a -r "${diskless_mount}" ]; then
sh ${diskless_mount}
fi
# If we booted a special kernel remove the record so we will boot
# the default kernel next time
rm -f /boot/nextboot.conf
# Reseed /dev/random with previously stored entropy.
case ${entropy_dir} in
[Nn][Oo])
;;
*)
entropy_dir=${entropy_dir:-/var/db/entropy}
if [ -d "${entropy_dir}" ]; then
if [ -w /dev/random ]; then
for seedfile in ${entropy_dir}/*; do
feed_dev_random "${seedfile}"
done
fi
fi
;;
esac
case ${entropy_file} in
[Nn][Oo] | '')
;;
*)
if [ -w /dev/random ]; then
feed_dev_random "${entropy_file}"
fi
;;
esac
adjkerntz -i
purgedir() {
local dir file
if [ $# -eq 0 ]; then
purgedir .
else
for dir
do
(
cd "$dir" && for file in .* *
do
[ ."$file" = .. -o ."$file" = ... ] && continue
if [ -d "$file" -a ! -L "$file" ]
then
purgedir "$file"
else
rm -f -- "$file"
fi
done
)
done
fi
}
clean_var() {
if [ -d /var/run -a ! -f /var/run/clean_var ]; then
purgedir /var/run
# Keep a copy of the boot messages around
dmesg >/var/run/dmesg.boot
# And an initial utmp file
(cd /var/run && cp /dev/null utmp && chmod 644 utmp;)
>/var/run/clean_var
fi
if [ -d /var/spool/lock -a ! -f /var/spool/lock/clean_var ]; then
purgedir /var/spool/lock
>/var/spool/lock/clean_var
fi
rm -rf /var/spool/uucp/.Temp/*
}
# network_pass1() *may* end up writing stuff to /var - we don't want to
# remove it immediately afterwards - *nor* do we want to fail to clean
# an NFS-mounted /var.
rm -f /var/run/clean_var /var/spool/lock/clean_var
clean_var
# Add additional swapfile, if configured.
#
case ${swapfile} in
[Nn][Oo] | '')
;;
*)
if [ -w "${swapfile}" -a -c /dev/mdctl ]; then
echo "Adding ${swapfile} as additional swap"
mdev=`mdconfig -a -t vnode -f ${swapfile}` && swapon /dev/${mdev}
fi
;;
esac
# Early pass to set the variables we can
#
if [ -r /etc/rc.sysctl ]; then
sh /etc/rc.sysctl first
fi
# Configure serial devices
#
if [ -r /etc/rc.serial ]; then
. /etc/rc.serial
fi
# Start up PC-card configuration
#
if [ -r /etc/rc.pccard ]; then
. /etc/rc.pccard
fi
# Start up the initial network configuration.
#
if [ -r /etc/rc.network ]; then
. /etc/rc.network # We only need to do this once.
network_pass1
fi
case ${ipv6_enable} in
[Yy][Ee][Ss])
if [ -r /etc/rc.network6 ]; then
. /etc/rc.network6 # We only need to do this once also.
network6_pass1
fi
;;
esac
# Mount NFS filesystems if present in /etc/fstab
#
# XXX When the vfsload() issues with nfsclient support and related sysctls
# have been resolved, this block can be removed, and the condition that
# skips nfs in the following block (for "other network filesystems") can
# be removed.
case "`mount -d -a -t nfs 2> /dev/null`" in
*mount_nfs*)
# Handle absent nfs client support
nfsclient_in_kernel=0
if sysctl vfs.nfs >/dev/null 2>&1; then
nfsclient_in_kernel=1
else
kldload nfsclient && nfsclient_in_kernel=1
fi
case ${nfsclient_in_kernel} in
1)
echo -n 'Mounting NFS filesystem:'
mount -a -t nfs
echo '.'
;;
*)
echo 'Warning: nfs mount requested, but no nfs client in kernel'
;;
esac
;;
esac
# Mount other network filesystems if present in /etc/fstab
for i in ${networkfs_types}; do
fstype=${i%:*}
fsdecr=${i#*:}
if [ "${fstype}" = "nfs" ]; then
continue
fi
case "`mount -d -a -t ${fstype}`" in
*mount_${fstype}*)
echo -n "Mounting ${fsdecr} filesystems:"
mount -a -t ${fstype}
echo '.'
;;
esac
done
# Whack the pty perms back into shape.
#
if ls /dev/tty[pqrsPQRS]* > /dev/null 2>&1; then
chflags 0 /dev/tty[pqrsPQRS]*
chmod 666 /dev/tty[pqrsPQRS]*
chown root:wheel /dev/tty[pqrsPQRS]*
fi
# Clean up left-over files
#
clean_var # If it hasn't already been done
rm /var/run/clean_var /var/spool/lock/clean_var
# Clearing /tmp at boot-time seems to have a long tradition. It doesn't
# help in any way for long-living systems, and it might accidentally
# clobber files you would rather like to have preserved after a crash
# (if not using mfs /tmp anyway).
#
# See also the example of another cleanup policy in /etc/periodic/daily.
#
case ${clear_tmp_enable} in
[Yy][Ee][Ss])
echo -n 'Clearing /tmp:'
# prune quickly with one rm, then use find to clean up /tmp/[lq]*
# (not needed with mfs /tmp, but doesn't hurt there...)
(cd /tmp && rm -rf [a-km-pr-zA-Z]* &&
find -d . ! -name . ! -name lost+found ! -name quota.user \
! -name quota.group -exec rm -rf -- {} \;)
echo '.'
;;
esac
# Remove X lock files, since they will prevent you from restarting X11
# after a system crash.
#
rm -f /tmp/.X*-lock
rm -fr /tmp/.X11-unix
mkdir -m 1777 /tmp/.X11-unix
# Snapshot any kernel -c changes back to disk here <someday>.
# This has changed with ELF and /kernel.config.
# Load LOMAC(4) security if wanted.
case ${lomac_enable} in
[Yy][Ee][Ss])
kldload mac_lomac >/dev/null 2>&1
;;
esac
echo -n 'Additional daemons:'
# Start system logging and name service. Named needs to start before syslogd
# if you don't have a /etc/resolv.conf.
#
case ${syslogd_enable} in
[Yy][Ee][Ss])
# Transitional symlink (for the next couple of years :) until all
# binaries have had a chance to move towards /var/run/log.
if [ ! -L /dev/log ]; then
# might complain for r/o root f/s
ln -sf /var/run/log /dev/log
fi
rm -f /var/run/log
echo -n ' syslogd';
${syslogd_program:-/usr/sbin/syslogd} ${syslogd_flags}
;;
esac
echo '.'
# Build device name databases if we are not using DEVFS
#
if sysctl vfs.devfs.generation > /dev/null 2>&1 ; then
rm -f /var/run/dev.db
else
dev_mkdb
fi
# $dumpdir should be a directory or a symbolic link
# to the crash directory if core dumps are to be saved.
#
if [ "${dumpdev}" != 'NO' ]; then
case ${dumpdir} in
'')
dumpdir='/var/crash'
;;
[Nn][Oo])
dumpdir='NO'
;;
esac
if [ "${dumpdir}" != 'NO' ]; then
echo -n 'Checking for core dump: '
/sbin/savecore ${savecore_flags} "${dumpdir}"
fi
fi
if [ -n "${network_pass1_done}" ]; then
network_pass2
fi
# Enable/Check the quotas (must be after ypbind if using NIS)
#
case ${enable_quotas} in
[Yy][Ee][Ss])
case ${check_quotas} in
[Yy][Ee][Ss])
echo -n 'Checking quotas:'
quotacheck -a
echo ' done.'
;;
esac
echo -n 'Enabling quotas:'
quotaon -a
echo ' done.'
;;
esac
if [ -n "${network_pass2_done}" ]; then
network_pass3
fi
# Check the password temp/lock file
#
if [ -e /etc/ptmp ]; then
logger -s -p auth.err \
"password file may be incorrect -- /etc/ptmp exists"
fi
case ${accounting_enable} in
[Yy][Ee][Ss])
if [ -d /var/account ]; then
echo 'Turning on accounting:'
if [ ! -e /var/account/acct ]; then
touch /var/account/acct
fi
accton /var/account/acct
fi
;;
esac
# Make shared lib searching a little faster. Leave /usr/lib first if you
# add your own entries or you may come to grief.
#
ldconfig="/sbin/ldconfig"
case ${ldconfig_insecure} in
[Yy][Ee][Ss])
ldconfig="${ldconfig} -i"
;;
esac
if [ -x /sbin/ldconfig ]; then
_LDC=/usr/lib
for i in ${ldconfig_paths}; do
if [ -d "${i}" ]; then
_LDC="${_LDC} ${i}"
fi
done
echo 'ELF ldconfig path:' ${_LDC}
${ldconfig} ${_LDC}
# Legacy aout support for i386 only
case `sysctl -n hw.machine_arch` in
i386)
# Default the a.out ldconfig path.
: ${ldconfig_paths_aout=${ldconfig_paths}}
_LDC=/usr/lib/aout
for i in ${ldconfig_paths_aout}; do
if [ -d "${i}" ]; then
_LDC="${_LDC} ${i}"
fi
done
echo 'a.out ldconfig path:' ${_LDC}
${ldconfig} -aout ${_LDC}
;;
esac
fi
# Now start up miscellaneous daemons that don't belong anywhere else
#
echo -n 'Starting standard daemons:'
case ${inetd_enable} in
[Nn][Oo])
;;
*)
echo -n ' inetd'; ${inetd_program:-/usr/sbin/inetd} ${inetd_flags}
;;
esac
case ${cron_enable} in
[Nn][Oo])
;;
*)
echo -n ' cron'; ${cron_program:-/usr/sbin/cron} ${cron_flags}
;;
esac
case ${lpd_enable} in
[Yy][Ee][Ss])
echo -n ' printer'; ${lpd_program:-/usr/sbin/lpd} ${lpd_flags}
;;
esac
case ${sshd_enable} in
[Yy][Ee][Ss])
if [ -x ${sshd_program:-/usr/sbin/sshd} ]; then
echo -n ' sshd';
${sshd_program:-/usr/sbin/sshd} ${sshd_flags}
fi
;;
esac
case ${usbd_enable} in
[Yy][Ee][Ss])
echo -n ' usbd'; /usr/sbin/usbd ${usbd_flags}
;;
esac
case ${mta_start_script} in
/*)
if [ -r ${mta_start_script} ]; then
sh ${mta_start_script}
fi
;;
esac
echo '.'
# Recover vi editor files.
find /var/tmp/vi.recover ! -type f -a ! -type d -delete
vibackup=`echo /var/tmp/vi.recover/vi.*`
if [ "${vibackup}" != '/var/tmp/vi.recover/vi.*' ]; then
echo -n 'Recovering vi editor sessions:'
for i in /var/tmp/vi.recover/vi.*; do
# Only test files that are readable.
if [ ! -r "${i}" ]; then
continue
fi
# Unmodified nvi editor backup files either have the
# execute bit set or are zero length. Delete them.
if [ -x "${i}" -o ! -s "${i}" ]; then
rm -f "${i}"
fi
done
# It is possible to get incomplete recovery files, if the editor
# crashes at the right time.
virecovery=`echo /var/tmp/vi.recover/recover.*`
if [ "${virecovery}" != "/var/tmp/vi.recover/recover.*" ]; then
for i in /var/tmp/vi.recover/recover.*; do
# Only test files that are readable.
if [ ! -r "${i}" ]; then
continue
fi
# Delete any recovery files that are zero length,
# corrupted, or that have no corresponding backup file.
# Else send mail to the user.
recfile=`awk '/^X-vi-recover-path:/{print $2}' < "${i}"`
if [ -n "${recfile}" -a -s "${recfile}" ]; then
sendmail -t < "${i}"
else
rm -f "${i}"
fi
done
fi
echo '.'
fi
# Make a bounds file for msgs(1) if there isn't one already
#
if [ -d /var/msgs -a ! -f /var/msgs/bounds -a ! -L /var/msgs/bounds ]; then
echo 0 > /var/msgs/bounds
fi
case ${update_motd} in
[Nn][Oo] | '')
;;
*)
if T=`mktemp /tmp/_motd.XXXXXX`; then
uname -v | sed -e 's,^\([^#]*\) #\(.* [1-2][0-9][0-9][0-9]\).*/\([^\]*\) $,\1 (\3) #\2,' > ${T}
awk '{if (NR == 1) {if ($1 == "FreeBSD") {next} else {print "\n"$0}} else {print}}' < /etc/motd >> ${T}
cmp -s ${T} /etc/motd || {
cp ${T} /etc/motd
chmod 644 /etc/motd
}
rm -f ${T}
fi
;;
esac
# Run rc.devfs if readable to customize devfs
#
if [ -r /etc/rc.devfs ]; then
sh /etc/rc.devfs
fi
# Configure implementation specific stuff
#
arch=`uname -p`
if [ -r /etc/rc.${arch} ]; then
. /etc/rc.${arch}
fi
# Configure the system console
#
if [ -r /etc/rc.syscons ]; then
. /etc/rc.syscons
fi
echo -n 'Additional ABI support:'
# Load the SysV IPC API if requested.
case ${sysvipc_enable} in
[Yy][Ee][Ss])
echo -n ' sysvipc'
kldload sysvmsg >/dev/null 2>&1
kldload sysvsem >/dev/null 2>&1
kldload sysvshm >/dev/null 2>&1
;;
esac
# Start the Linux binary compatibility if requested.
#
case ${linux_enable} in
[Yy][Ee][Ss])
echo -n ' linux'
if ! kldstat -v | grep -E 'linux(aout|elf)' > /dev/null; then
kldload linux > /dev/null 2>&1
fi
if [ -x /compat/linux/sbin/ldconfig ]; then
/compat/linux/sbin/ldconfig
fi
;;
esac
# Start the SysVR4 binary emulation if requested.
#
case ${svr4_enable} in
[Yy][Ee][Ss])
echo -n ' svr4'; kldload svr4 > /dev/null 2>&1
;;
esac
echo '.'
# Do traditional (but rather obsolete) rc.local file if it exists. If you
# use this file and want to make it programmatic, source /etc/defaults/rc.conf
# in /etc/rc.local and add your custom variables to /etc/rc.conf, as
# shown below. Please do not put local extensions into /etc/rc itself.
# Use /etc/rc.local
#
# ---- rc.local ----
# if [ -r /etc/defaults/rc.conf ]; then
# . /etc/defaults/rc.conf
# source_rc_confs
# elif [ -r /etc/rc.conf ]; then
# . /etc/rc.conf
# fi
#
# ... additional startup conditionals ...
# ---- rc.local ----
#
if [ -r /etc/rc.local ]; then
echo -n 'Starting local daemons:'
sh /etc/rc.local
echo '.'
fi
# For each valid dir in $local_startup, search for init scripts matching *.sh
#
case ${local_startup} in
[Nn][Oo] | '')
;;
*)
echo -n 'Local package initialization:'
slist=""
if [ -z "${script_name_sep}" ]; then
script_name_sep=" "
fi
for dir in ${local_startup}; do
if [ -d "${dir}" ]; then
for script in ${dir}/*.sh; do
slist="${slist}${script_name_sep}${script}"
done
fi
done
script_save_sep="$IFS"
IFS="${script_name_sep}"
for script in ${slist}; do
if [ -x "${script}" ]; then
(set -T
trap 'exit 1' 2
${script} start)
elif [ -f "${script}" -o -L "${script}" ]; then
echo -n " (skipping ${script##*/}, not executable)"
fi
done
IFS="${script_save_sep}"
echo '.'
;;
esac
if [ -n "${network_pass3_done}" ]; then
network_pass4
fi
# Late pass to set variables we missed the first time
#
if [ -r /etc/rc.sysctl ]; then
sh /etc/rc.sysctl last
fi
# Raise kernel security level. This should be done only after `fsck' has
# repaired local filesystems if you want the securelevel to be greater than 1.
#
case ${kern_securelevel_enable} in
[Yy][Ee][Ss])
if [ "${kern_securelevel}" -ge 0 ]; then
echo 'Raising kernel security level: '
sysctl kern.securelevel=${kern_securelevel}
fi
;;
esac
# Start background fsck checks if necessary
case ${background_fsck} in
[Yy][Ee][Ss])
bgfsck_msg='Starting background file system checks'
if [ ${background_fsck_delay:=0} -gt 0 ]; then
bgfsck_msg="${bgfsck_msg} in ${background_fsck_delay} seconds"
fi
echo "${bgfsck_msg}."
(sleep ${background_fsck_delay}; nice -4 fsck -B -p) 2>&1 | \
logger -p daemon.notice -t fsck &
;;
esac
echo ''
date
exit 0

View File

@ -1,220 +0,0 @@
#!/bin/sh
#
# Copyright (c) 2000 The FreeBSD Project
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
# 1. Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
# 2. Redistributions in binary form must reproduce the above copyright
# notice, this list of conditions and the following disclaimer in the
# documentation and/or other materials provided with the distribution.
#
# THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
# ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
# SUCH DAMAGE.
#
# $FreeBSD$
#
#
# ATM networking startup script
#
# Initial interface configuration.
# N.B. /usr is not mounted.
#
atm_pass1() {
# Locate all probed ATM adapters
atmdev=`atm sh stat int | while read dev junk; do
case ${dev} in
hea[0-9] | hea[0-9][0-9])
echo "${dev} "
;;
hfa[0-9] | hfa[0-9][0-9])
echo "${dev} "
;;
idt[0-9] | idt[0-9][0-9])
echo "${dev} "
;;
*)
continue
;;
esac
done`
if [ -z "${atmdev}" ]; then
echo 'No ATM adapters found'
return 0
fi
# Load microcode into FORE adapters (if needed)
if [ `expr "${atmdev}" : '.*hfa.*'` -ne 0 ]; then
fore_dnld
fi
# Configure physical interfaces
ilmid=0
for phy in ${atmdev}; do
echo -n "Configuring ATM device ${phy}:"
# Define network interfaces
eval netif_args=\$atm_netif_${phy}
if [ -n "${netif_args}" ]; then
atm set netif ${phy} ${netif_args} || continue
else
echo ' missing network interface definition'
continue
fi
# Override physical MAC address
eval macaddr_args=\$atm_macaddr_${phy}
if [ -n "${macaddr_args}" ]; then
case ${macaddr_args} in
[Nn][Oo] | '')
;;
*)
atm set mac ${phy} ${macaddr_args} || continue
;;
esac
fi
# Configure signalling manager
eval sigmgr_args=\$atm_sigmgr_${phy}
if [ -n "${sigmgr_args}" ]; then
atm attach ${phy} ${sigmgr_args} || continue
else
echo ' missing signalling manager definition'
continue
fi
# Configure UNI NSAP prefix
eval prefix_args=\$atm_prefix_${phy}
if [ `expr "${sigmgr_args}" : '[uU][nN][iI].*'` -ne 0 ]; then
if [ -z "${prefix_args}" ]; then
echo ' missing NSAP prefix for UNI interface'
continue
fi
case ${prefix_args} in
ILMI)
ilmid=1
;;
*)
atm set prefix ${phy} ${prefix_args} || continue
;;
esac
fi
atm_phy="${atm_phy} ${phy}"
echo '.'
done
echo -n 'Starting initial ATM daemons:'
# Start ILMI daemon (if needed)
case ${ilmid} in
1)
echo -n ' ilmid'
ilmid
;;
esac
echo '.'
atm_pass1_done=YES
}
#
# Finish up configuration.
# N.B. /usr is not mounted.
#
atm_pass2() {
echo -n 'Configuring ATM network interfaces:'
atm_scspd=0
atm_atmarpd=""
# Configure network interfaces
for phy in ${atm_phy}; do
eval netif_args=\$atm_netif_${phy}
set -- ${netif_args}
netname=$1
netcnt=$2
netindx=0
while [ ${netindx} -lt ${netcnt} ]; do
net="${netname}${netindx}"
netindx=$((${netindx} + 1))
echo -n " ${net}"
# Configure atmarp server
eval atmarp_args=\$atm_arpserver_${net}
if [ -n "${atmarp_args}" ]; then
atm set arpserver ${net} ${atmarp_args} ||
continue
fi
eval scsparp_args=\$atm_scsparp_${net}
case ${scsparp_args} in
[Yy][Ee][Ss])
case ${atmarp_args} in
local)
;;
*)
echo ' local arpserver required for SCSP'
continue
;;
esac
atm_atmarpd="${atm_atmarpd} ${net}"
atm_scspd=1
esac
done
done
echo '.'
# Define any PVCs.
if [ -n "${atm_pvcs}" ]; then
for i in ${atm_pvcs}; do
eval pvc_args=\$atm_pvc_${i}
atm add pvc ${pvc_args}
done
fi
# Define any permanent ARP entries.
if [ -n "${atm_arps}" ]; then
for i in ${atm_arps}; do
eval arp_args=\$atm_arp_${i}
atm add arp ${arp_args}
done
fi
atm_pass2_done=YES
}
#
# Start any necessary daemons.
#
atm_pass3() {
# Start SCSP daemon (if needed)
case ${atm_scspd} in
1)
echo -n ' scspd'
scspd
;;
esac
# Start ATMARP daemon (if needed)
if [ -n "${atm_atmarpd}" ]; then
echo -n ' atmarpd'
atmarpd ${atm_atmarpd}
fi
atm_pass3_done=YES
}

View File

@ -1,59 +0,0 @@
#!/bin/sh -
# Copyright (c) 1998 Søren Schmidt
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
# 1. Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
# 2. Redistributions in binary form must reproduce the above copyright
# notice, this list of conditions and the following disclaimer in the
# documentation and/or other materials provided with the distribution.
#
# THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
# ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
# SUCH DAMAGE.
#
# $FreeBSD$
#
# If there is a global system configuration file, suck it in.
if [ -r /etc/defaults/rc.conf ]; then
. /etc/defaults/rc.conf
source_rc_confs
elif [ -r /etc/rc.conf ]; then
. /etc/rc.conf
fi
# Setup DEVFS, ie permissions, links etc.
#
cd /dev
# This isn't necessarily a good example, since we probably shouldn't need this.
# However, a lot of X software depends on it.
#
if [ -c ttyv0 -a ! -e vga ]; then
ln -fs ttyv0 vga
fi
# Commonly used by many ports
#
#if [ -c acd0c -a ! -e cdrom ]; then
# ln -fs acd0c cdrom
#fi
# Allow users to query the smb device
#
#if [ -c smb0 ]; then
# chmod 660 smb0
#fi

View File

@ -1,225 +0,0 @@
# Copyright (c) 1999-2002 Matt Dillion. Terms and conditions based on
# the FreeBSD copyright as found at the base of the source distribution.
#
# $FreeBSD$
#
# /etc/rc.diskless1 - general BOOTP startup
#
# On entry to this script the entire system consists of a read-only root
# mounted via NFS. We use the contents of /conf to create and populate
# memory filesystems. The kernel has run BOOTP and configured an interface
# (otherwise it would not have been able to mount the NFS root!)
#
# The following directories are scanned. Each sucessive directory overrides
# (is merged into) the previous one.
#
# /conf/base universal base
# /conf/default modified by a secondary universal base
# /conf/${ipba} modified based on the assigned broadcast IP
# /conf/${ip} modified based on the machine's assigned IP
#
# Each of these directories may contain any number of subdirectories which
# represent directories in / on the diskless machine. The existance of
# these subdirectories causes this script to create a MEMORY FILESYSTEM for
# /<sub_directory_name>. For example, if /conf/base/etc exists then a
# memory filesystem will be created for /etc.
#
# If a subdirectory contains the file 'diskless_remount' the contents of
# the file is used to remount the subdirectory prior to it being copied to
# the memory filesystem. For example, if /conf/base/etc/diskless_remount
# contains the string 'my.server.com:/etc' then my.server.com:/etc will be
# mounted in place of the subdirectory. This allows you to avoid making
# duplicates of system directories in /conf.
#
# If a subdirectory contains the file 'md_size', the contents of the
# file is used to determine the size of the memory filesystem, in 512
# byte sectors. The default is 8192 (4MB). You only have to specify an
# md_size if the default doesn't work for you (i.e. if it is too big or
# too small). Note that in -current the default is 4096 (2MB). For
# example, /conf/base/etc/md_size might contain '16384'.
#
# If /conf/<special_dir>/SUBDIR.cpio.gz exists, the file is cpio'd into
# the specified /SUBDIR (and a memory filesystem is created for /SUBDIR
# if necessary).
#
# If /conf/<special_dir>/SUBDIR.remove exists, the file contains a list
# of paths which are rm -rf'd relative to /SUBDIR.
#
# You will almost universally want to create a /conf/base/etc containing
# a diskless_remount and possibly an md_size file. You will then almost
# universally want to override rc.conf, rc.local, and fstab by creating
# /conf/default/etc/{rc.conf,rc.local,fstab}. Your fstab should be sure
# to mount a /usr... typically an NFS readonly /usr.
#
# NOTE! rc.diskless2 will create /var, /tmp, and /dev. Those filesystems
# should not be specified in /conf. At least not yet.
# chkerr:
#
# Routine to check for error
#
# checks error code and drops into shell on failure.
# if shell exits, terminates script as well as /etc/rc.
#
chkerr() {
case $1 in
0)
;;
*)
echo "$2 failed: dropping into /bin/sh"
/bin/sh
# RESUME
;;
esac
}
# Create a generic memory disk
#
mount_md() {
/sbin/mdconfig -a -t malloc -s $1 -u $3
/sbin/disklabel -r -w md$3 auto
/sbin/newfs -i 4096 /dev/md$3c
/sbin/mount /dev/md$3c $2
}
# Create the memory filesystem if it has not already been created
#
create_md() {
if [ "x`eval echo \\$md_created_$1`" = "x" ]; then
if [ "x`eval echo \\$md_size_$1`" = "x" ]; then
md_size=4096
else
md_size=`eval echo \\$md_size_$1`
fi
mount_md $md_size /$1 0
/bin/chmod 755 /$1
eval md_created_$1=created
fi
}
# DEBUGGING
#
# set -v
# Figure out our interface and IP.
#
bootp_ifc=""
bootp_ipa=""
bootp_ipbca=""
iflist=`ifconfig -l`
for i in ${iflist} ; do
set `ifconfig ${i}`
while [ $# -ge 1 ] ; do
if [ "${bootp_ifc}" = "" -a "$1" = "inet" ] ; then
bootp_ifc=${i} ; bootp_ipa=${2} ; shift
fi
if [ "${bootp_ipbca}" = "" -a "$1" = "broadcast" ] ; then
bootp_ipbca=$2; shift
fi
shift
done
if [ "${bootp_ifc}" != "" ] ; then
break
fi
done
echo "Interface ${bootp_ifc} IP-Address ${bootp_ipa} Broadcast ${bootp_ipbca}"
# Resolve templates in /conf/base, /conf/default, /conf/${bootp_ipbca},
# and /conf/${bootp_ipa}. For each subdirectory found within these
# directories:
#
# - calculate memory filesystem sizes. If the subdirectory (prior to
# NFS remounting) contains the file 'md_size', the contents specified
# in 512 byte sectors will be used to size the memory filesystem. Otherwise
# 8192 sectors (4MB) is used.
#
# - handle NFS remounts. If the subdirectory contains the file
# diskless_remount, the contents of the file is NFS mounted over
# the directory. For example /conf/base/etc/diskless_remount
# might contain 'myserver:/etc'. NFS remounts allow you to avoid
# having to dup your system directories in /conf. Your server must
# be sure to export those filesystems -alldirs, however.
#
for i in base default ${bootp_ipbca} ${bootp_ipa} ; do
for j in /conf/$i/* ; do
# memory filesystem size specification
#
subdir=${j##*/}
if [ -d $j -a -f $j/md_size ]; then
eval md_size_$subdir=`cat $j/md_size`
fi
# NFS remount
#
if [ -d $j -a -f $j/diskless_remount ]; then
nfspt=`/bin/cat $j/diskless_remount`
mount_nfs $nfspt $j
chkerr $? "mount_nfs $nfspt $j"
fi
done
done
# - Create all required MFS filesystems and populate them from
# our templates. Support both a direct template and a dir.cpio.gz
# archive. Support dir.remove files containing a list of relative
# paths to remove.
#
# TODO:
# + find a way to assign a 'group' identifier to a machine
# so we can use group-specific configurations;
for i in base default ${bootp_ipbca} ${bootp_ipa} ; do
for j in /conf/$i/* ; do
subdir=${j##*/}
if [ -d $j ]; then
create_md $subdir
cp -Rp $j/* /$subdir
fi
done
for j in /conf/$i/*.cpio.gz ; do
subdir=${j%*.cpio.gz}
subdir=${subdir##*/}
if [ -f $j ]; then
create_md $subdir
echo "Loading /$subdir from cpio archive $j"
(cd / ; /stand/gzip -d < $j | /stand/cpio --extract -d )
fi
done
for j in /conf/$i/*.remove ; do
subdir=${j%*.remove}
subdir=${subdir##*/}
if [ -f $j ]; then
# doubly sure it is a memory disk before rm -rf'ing
create_md $subdir
(cd /$subdir; rm -rf `/bin/cat $j`)
fi
done
done
if [ -z "`hostname -s`" ]; then
hostname=`kenv dhcp.host-name`
hostname $hostname
echo "Hostname is $hostname"
fi
# if the info is available via dhcp/kenv
# build the resolv.conf
#
if [ ! -e /etc/resolv.conf ]; then
echo domain `kenv dhcp.domain-name` > /etc/resolv.conf
set `kenv dhcp.domain-name-servers`
for ns in `IFS=','; echo $*`; do
echo nameserver $ns >> /etc/resolv.conf;
done
fi
# Tell /etc/rc to run the specified script after it does its mounts but
# before it does anything else.
#
# This script is responsible for setting up the diskless mount environment.
# This can be overriden by /conf/ME/rc.conf.local if, for example, you do not
# want to run the standard system /etc/rc.diskless2
diskless_mount="/etc/rc.diskless2"

View File

@ -1,138 +0,0 @@
# Copyright (c) 1999 Matt Dillon
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
# 1. Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
# 2. Redistributions in binary form must reproduce the above copyright
# notice, this list of conditions and the following disclaimer in the
# documentation and/or other materials provided with the distribution.
#
# THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
# ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
# SUCH DAMAGE.
#
# $FreeBSD$
#
#
# rc.diskless2
#
# Provide a function for normalizing the mounting of memory
# filesystems. This should allow the rest of the code here to remain
# as close as possible between 5-current and 4-stable.
# $1 = size
# $2 = mount point
# $3 = md unit number (ignored in pre 5.0 systems)
# $4 = (optional) bytes-per-inode
mount_md() {
if [ -n "$4" ]; then
bpi="-i $4"
fi
/sbin/mdconfig -a -t malloc -s $1 -u $3
/sbin/disklabel -r -w md$3 auto
/sbin/newfs $bpi /dev/md$3c
/sbin/mount /dev/md$3c $2
}
# If there is a global system configuration file, suck it in.
#
if [ -r /etc/defaults/rc.conf ]; then
. /etc/defaults/rc.conf
source_rc_confs
elif [ -r /etc/rc.conf ]; then
. /etc/rc.conf
fi
# If we do not have a writable /var, create a memory
# filesystem for /var. We don't have /usr yet so
# use mkdir instead of touch to test. We want mount
# to record its mounts so we have to make sure /var/db
# exists before doing the mount -a.
#
if (/bin/mkdir /var/.diskless 2> /dev/null); then
rmdir /var/.diskless
else
echo "+++ mount_md of /var"
mount_md ${varsize:=32m} /var 1
fi
if [ ! -d /var/db ]; then
mkdir /var/db
fi
# Now we need the rest of our mounts, particularly /usr
#
mount -a # chown and chgrp are in /usr
# Populate /var
#
echo "+++ populate /var using /etc/mtree/BSD.var.dist"
/usr/sbin/mtree -deU -f /etc/mtree/BSD.var.dist -p /var > /dev/null
case ${sendmail_enable} in
[Nn][Oo][Nn][Ee])
;;
*)
/usr/sbin/mtree -deU -f /etc/mtree/BSD.sendmail.dist -p / > /dev/null
;;
esac
echo "+++ create log files based on the contents of /etc/newsyslog.conf"
LOGFILES=`/usr/bin/awk '$1 != "#" { printf "%s ", $1 } ' /etc/newsyslog.conf`
if [ -n "$LOGFILES" ]; then
/usr/bin/touch $LOGFILES
fi
echo "+++ create lastlog"
/usr/bin/touch /var/log/lastlog
# Make sure our aliases database is uptodate, the aliases may have
# been overriden in /conf.
#
/usr/bin/newaliases
# XXX make sure to create one dir for each printer as requested by lpd
#
# If we do not have a writable /tmp, create a memory
# filesystem for /tmp. If /tmp is a symlink (e.g. to /var/tmp,
# then it should already be writable).
#
if (/bin/mkdir /tmp/.diskless 2> /dev/null); then
rmdir /tmp/.diskless
else
if [ -h /tmp ]; then
echo "*** /tmp is a symlink to a non-writable area!"
echo "dropping into shell, ^D to continue anyway."
/bin/sh
else
mount_md ${tmpsize:=20480} /tmp 2
chmod 01777 /tmp
fi
fi
if sysctl vfs.devfs.generation > /dev/null 2>&1 ; then
# we have DEVFS, no worries...
true
elif (/bin/mkdir /dev/.diskless 2> /dev/null); then
# if /dev is writable assume it has already been populated
# via rc.diskless1
#
rmdir /dev/.diskless
else
(cd /; find -x dev | cpio -o -H newc) > /tmp/dev.tmp
mount_md 4096 /dev 3 512
(cd /; cpio -i -H newc -d < /tmp/dev.tmp)
rm -f /tmp/dev.tmp
fi

View File

@ -1,96 +0,0 @@
#!/bin/sh
#
# Copyright (c) 1999 Hellmuth Michaelis
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
# 1. Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
# 2. Redistributions in binary form must reproduce the above copyright
# notice, this list of conditions and the following disclaimer in the
# documentation and/or other materials provided with the distribution.
#
# THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
# ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
# SUCH DAMAGE.
#
# $FreeBSD$
#
#---------------------------------------------------------------------------
#
# /etc/rc.isdn - isdn4bsd startup script
# --------------------------------------
#
#---------------------------------------------------------------------------
case ${isdn_enable} in
[Yy][Ee][Ss])
echo -n 'ISDN subsystem setup:'
# Check for pcvt driver (VT100/VT220 emulator)
#
if [ -x /usr/sbin/ispcvt ]; then
if /usr/sbin/ispcvt; then
# No vidcontrol if we are using pcvt
#
isdn_screenflags=NO
fi
fi
case ${isdn_flags} in
[Nn][Oo])
isdn_flags=''
;;
esac
# Start the isdn daemon
#
if [ -x /usr/sbin/isdnd ]; then
echo -n ' isdnd'
case ${isdn_fsdev} in
[Nn][Oo] | '')
/usr/sbin/isdnd ${isdn_flags}
;;
*)
# Change vidmode of ${isdn_fsdev}
#
case ${isdn_screenflags} in
[Nn][Oo])
;;
*)
if [ -x /usr/sbin/vidcontrol ]; then
/usr/sbin/vidcontrol < ${isdn_fsdev} > ${isdn_fsdev} 2>&1 ${isdn_screenflags}
fi
;;
esac
/usr/sbin/isdnd ${isdn_flags} -f -r ${isdn_fsdev} -t ${isdn_ttype}
;;
esac
fi
# Start isdntrace
#
case ${isdn_trace} in
[Yy][Ee][Ss])
if [ -x /usr/sbin/isdntrace ]; then
echo -n ' isdntrace'
nohup /usr/sbin/isdntrace ${isdn_traceflags} >/dev/null 2>&1 &
fi
;;
esac
echo '.'
;;
esac

View File

@ -1,959 +0,0 @@
#!/bin/sh -
#
# Copyright (c) 1993 The FreeBSD Project
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
# 1. Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
# 2. Redistributions in binary form must reproduce the above copyright
# notice, this list of conditions and the following disclaimer in the
# documentation and/or other materials provided with the distribution.
#
# THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
# ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
# SUCH DAMAGE.
#
# $FreeBSD$
# From: @(#)netstart 5.9 (Berkeley) 3/30/91
#
# Note that almost all of the user-configurable behavior is no longer in
# this file, but rather in /etc/defaults/rc.conf. Please check that file
# first before contemplating any changes here. If you do need to change
# this file for some reason, we would like to know about it.
# First pass startup stuff.
#
network_pass1() {
echo -n 'Doing initial network setup:'
# Generate host.conf for compatibility
#
if [ -f "/etc/nsswitch.conf" ]; then
echo -n ' host.conf'
generate_host_conf /etc/nsswitch.conf /etc/host.conf
fi
# Convert host.conf to nsswitch.conf if necessary
#
if [ -f "/etc/host.conf" -a ! -f "/etc/nsswitch.conf" ]; then
echo ''
echo 'Warning: /etc/host.conf is no longer used'
echo ' /etc/nsswitch.conf will be created for you'
convert_host_conf /etc/host.conf /etc/nsswitch.conf
fi
# Set the host name if it is not already set
#
if [ -z "`hostname -s`" ]; then
hostname ${hostname}
echo -n ' hostname'
fi
# Establish ipfilter ruleset as early as possible (best in
# addition to IPFILTER_DEFAULT_BLOCK in the kernel config file)
# check whether ipfilter and/or ipnat is enabled
ipfilter_active="NO"
case ${ipfilter_enable} in
[Yy][Ee][Ss])
ipfilter_active="YES"
;;
esac
case ${ipnat_enable} in
[Yy][Ee][Ss])
ipfilter_active="YES"
;;
esac
case ${ipfilter_active} in
[Yy][Ee][Ss])
# load ipfilter kernel module if needed
if ! sysctl net.inet.ipf.fr_pass > /dev/null 2>&1; then
if kldload ipl; then
echo 'IP-filter module loaded.'
else
echo 'Warning: IP-filter module failed to load.'
# avoid further errors
ipfilter_active="NO"
ipmon_enable="NO"
ipfilter_enable="NO"
ipnat_enable="NO"
ipfs_enable="NO"
fi
fi
# start ipmon before loading any rules
case "${ipmon_enable}" in
[Yy][Ee][Ss])
echo -n ' ipmon'
${ipmon_program:-/sbin/ipmon} ${ipmon_flags}
;;
esac
case "${ipfilter_enable}" in
[Yy][Ee][Ss])
if [ -r "${ipfilter_rules}" -o \
-r "${ipv6_ipfilter_rules}" ]; then
echo -n ' ipfilter'
${ipfilter_program:-/sbin/ipf} -Fa
if [ -r "${ipfilter_rules}" ]; then
${ipfilter_program:-/sbin/ipf} \
-f "${ipfilter_rules}" \
${ipfilter_flags}
fi
${ipfilter_program:-/sbin/ipf} -6 -Fa
if [ -r "${ipv6_ipfilter_rules}" ]; then
${ipfilter_program:-/sbin/ipf} -6 \
-f "${ipv6_ipfilter_rules}" \
${ipfilter_flags}
fi
else
ipfilter_enable="NO"
echo -n ' NO IPF RULES'
fi
;;
esac
case "${ipnat_enable}" in
[Yy][Ee][Ss])
if [ -r "${ipnat_rules}" ]; then
echo -n ' ipnat'
eval ${ipnat_program:-/sbin/ipnat} -CF -f \
"${ipnat_rules}" ${ipnat_flags}
else
ipnat_enable="NO"
echo -n ' NO IPNAT RULES'
fi
;;
esac
# restore filter/NAT state tables after loading the rules
case "${ipfs_enable}" in
[Yy][Ee][Ss])
if [ -r "/var/db/ipf/ipstate.ipf" ]; then
echo -n ' ipfs'
${ipfs_program:-/sbin/ipfs} -R ${ipfs_flags}
# remove files to avoid reloading old state
# after an ungraceful shutdown
rm -f /var/db/ipf/ipstate.ipf
rm -f /var/db/ipf/ipnat.ipf
fi
;;
esac
;;
esac
# Set the domainname if we're using NIS
#
case ${nisdomainname} in
[Nn][Oo] | '')
;;
*)
domainname ${nisdomainname}
echo -n ' domain'
;;
esac
echo '.'
# Initial ATM interface configuration
#
case ${atm_enable} in
[Yy][Ee][Ss])
if [ -r /etc/rc.atm ]; then
. /etc/rc.atm
atm_pass1
fi
;;
esac
# Attempt to create cloned interfaces.
for ifn in ${cloned_interfaces}; do
ifconfig ${ifn} create
done
# Special options for sppp(4) interfaces go here. These need
# to go _before_ the general ifconfig section, since in the case
# of hardwired (no link1 flag) but required authentication, you
# cannot pass auth parameters down to the already running interface.
#
for ifn in ${sppp_interfaces}; do
eval spppcontrol_args=\$spppconfig_${ifn}
if [ -n "${spppcontrol_args}" ]; then
# The auth secrets might contain spaces; in order
# to retain the quotation, we need to eval them
# here.
eval spppcontrol ${ifn} ${spppcontrol_args}
fi
done
# gifconfig
network_gif_setup
# Set up all the network interfaces, calling startup scripts if needed
#
case ${network_interfaces} in
[Aa][Uu][Tt][Oo])
network_interfaces="`ifconfig -l`"
;;
*)
network_interfaces="${network_interfaces} ${cloned_interfaces}"
;;
esac
dhcp_interfaces=""
for ifn in ${network_interfaces}; do
_up=`ifconfig ${ifn} | head -1 | grep -v LOOPBACK | grep UP,`
if [ "$_up" != "" ]; then
# Interface is already up, so ignore it.
continue;
fi
if [ -r /etc/start_if.${ifn} ]; then
. /etc/start_if.${ifn}
eval showstat_$ifn=1
fi
# Do the primary ifconfig if specified
#
eval ifconfig_args=\$ifconfig_${ifn}
case ${ifconfig_args} in
'')
;;
[Dd][Hh][Cc][Pp])
# DHCP inits are done all in one go below
dhcp_interfaces="$dhcp_interfaces $ifn"
eval showstat_$ifn=1
;;
*)
ifconfig ${ifn} ${ifconfig_args}
eval showstat_$ifn=1
;;
esac
done
if [ ! -z "${dhcp_interfaces}" ]; then
${dhcp_program:-/sbin/dhclient} ${dhcp_flags} ${dhcp_interfaces}
fi
for ifn in ${network_interfaces}; do
# 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
eval showstat_$ifn=1
alias=$((${alias} + 1))
else
break;
fi
done
# Do ipx address if specified
#
eval ifconfig_args=\$ifconfig_${ifn}_ipx
if [ -n "${ifconfig_args}" ]; then
ifconfig ${ifn} ${ifconfig_args}
eval showstat_$ifn=1
fi
done
for ifn in ${network_interfaces}; do
eval showstat=\$showstat_${ifn}
if [ ! -z ${showstat} ]; then
ifconfig ${ifn}
fi
done
# ISDN subsystem startup
#
case ${isdn_enable} in
[Yy][Ee][Ss])
if [ -r /etc/rc.isdn ]; then
. /etc/rc.isdn
fi
;;
esac
# Start user ppp if required. This must happen before natd.
#
case ${ppp_enable} in
[Yy][Ee][Ss])
# Establish ppp mode.
#
if [ "${ppp_mode}" != "ddial" -a "${ppp_mode}" != "direct" \
-a "${ppp_mode}" != "dedicated" \
-a "${ppp_mode}" != "background" ]; then
ppp_mode="auto"
fi
ppp_command="/usr/sbin/ppp -quiet -${ppp_mode}"
# Switch on NAT mode?
#
case ${ppp_nat} in
[Yy][Ee][Ss])
ppp_command="${ppp_command} -nat"
;;
esac
ppp_command="${ppp_command} ${ppp_profile}"
echo "Starting ppp as \"${ppp_user}\""
su -m ${ppp_user} -c "exec ${ppp_command}"
;;
esac
# Re-Sync ipfilter so it picks up any new network interfaces
#
case ${ipfilter_active} in
[Yy][Ee][Ss])
${ipfilter_program:-/sbin/ipf} -y ${ipfilter_flags} >/dev/null
;;
esac
unset ipfilter_active
# Initialize IP filtering using ipfw
#
if /sbin/ipfw -q flush > /dev/null 2>&1; then
firewall_in_kernel=1
else
firewall_in_kernel=0
fi
case ${firewall_enable} in
[Yy][Ee][Ss])
if [ "${firewall_in_kernel}" -eq 0 ] && kldload ipfw; then
firewall_in_kernel=1
echo 'Kernel firewall module loaded'
elif [ "${firewall_in_kernel}" -eq 0 ]; then
echo 'Warning: firewall kernel module failed to load'
fi
;;
esac
# Load the filters if required
#
case ${firewall_in_kernel} in
1)
if [ -z "${firewall_script}" ]; then
firewall_script=/etc/rc.firewall
fi
case ${firewall_enable} in
[Yy][Ee][Ss])
if [ -r "${firewall_script}" ]; then
. "${firewall_script}"
echo -n 'Firewall rules loaded, starting divert daemons:'
# Network Address Translation daemon
#
case ${natd_enable} in
[Yy][Ee][Ss])
if [ -n "${natd_interface}" ]; then
if echo ${natd_interface} | \
grep -q -E '^[0-9]+(\.[0-9]+){0,3}$'; then
natd_flags="$natd_flags -a ${natd_interface}"
else
natd_flags="$natd_flags -n ${natd_interface}"
fi
fi
echo -n ' natd'; ${natd_program:-/sbin/natd} ${natd_flags}
;;
esac
echo '.'
elif [ "`ipfw l 65535`" = "65535 deny ip from any to any" ]; then
echo 'Warning: kernel has firewall functionality,' \
'but firewall rules are not enabled.'
echo ' All ip services are disabled.'
fi
case ${firewall_logging} in
[Yy][Ee][Ss] | '')
echo 'Firewall logging=YES'
sysctl net.inet.ip.fw.verbose=1 >/dev/null
;;
*)
;;
esac
;;
esac
;;
esac
# Additional ATM interface configuration
#
if [ -n "${atm_pass1_done}" ]; then
atm_pass2
fi
# Configure routing
#
case ${defaultrouter} in
[Nn][Oo] | '')
;;
*)
static_routes="default ${static_routes}"
route_default="default ${defaultrouter}"
;;
esac
# Set up any static routes. This should be done before router discovery.
#
if [ -n "${static_routes}" ]; then
for i in ${static_routes}; do
eval route_args=\$route_${i}
route add ${route_args}
done
fi
echo -n 'Additional routing options:'
case ${tcp_extensions} in
[Yy][Ee][Ss] | '')
;;
*)
echo -n ' tcp extensions=NO'
sysctl net.inet.tcp.rfc1323=0 >/dev/null
;;
esac
case ${icmp_bmcastecho} in
[Yy][Ee][Ss])
echo -n ' broadcast ping responses=YES'
sysctl net.inet.icmp.bmcastecho=1 >/dev/null
;;
esac
case ${icmp_drop_redirect} in
[Yy][Ee][Ss])
echo -n ' ignore ICMP redirect=YES'
sysctl net.inet.icmp.drop_redirect=1 >/dev/null
;;
esac
case ${icmp_log_redirect} in
[Yy][Ee][Ss])
echo -n ' log ICMP redirect=YES'
sysctl net.inet.icmp.log_redirect=1 >/dev/null
;;
esac
case ${gateway_enable} in
[Yy][Ee][Ss])
echo -n ' IP gateway=YES'
sysctl net.inet.ip.forwarding=1 >/dev/null
;;
esac
case ${forward_sourceroute} in
[Yy][Ee][Ss])
echo -n ' do source routing=YES'
sysctl net.inet.ip.sourceroute=1 >/dev/null
;;
esac
case ${accept_sourceroute} in
[Yy][Ee][Ss])
echo -n ' accept source routing=YES'
sysctl net.inet.ip.accept_sourceroute=1 >/dev/null
;;
esac
case ${tcp_keepalive} in
[Nn][Oo])
echo -n ' TCP keepalive=NO'
sysctl net.inet.tcp.always_keepalive=0 >/dev/null
;;
esac
case ${tcp_drop_synfin} in
[Yy][Ee][Ss])
echo -n ' drop SYN+FIN packets=YES'
sysctl net.inet.tcp.drop_synfin=1 >/dev/null
;;
esac
case ${ipxgateway_enable} in
[Yy][Ee][Ss])
echo -n ' IPX gateway=YES'
sysctl net.ipx.ipx.ipxforwarding=1 >/dev/null
;;
esac
case ${arpproxy_all} in
[Yy][Ee][Ss])
echo -n ' ARP proxyall=YES'
sysctl net.link.ether.inet.proxyall=1 >/dev/null
;;
esac
case ${ip_portrange_first} in
[Nn][Oo] | '')
;;
*)
echo -n " ip_portrange_first=$ip_portrange_first"
sysctl net.inet.ip.portrange.first=$ip_portrange_first >/dev/null
;;
esac
case ${ip_portrange_last} in
[Nn][Oo] | '')
;;
*)
echo -n " ip_portrange_last=$ip_portrange_last"
sysctl net.inet.ip.portrange.last=$ip_portrange_last >/dev/null
;;
esac
echo '.'
case ${ipsec_enable} in
[Yy][Ee][Ss])
if [ -f ${ipsec_file} ]; then
echo ' ipsec: enabled'
setkey -f ${ipsec_file}
else
echo ' ipsec: file not found'
fi
;;
esac
echo -n 'Routing daemons:'
case ${router_enable} in
[Yy][Ee][Ss])
echo -n " ${router}"; ${router} ${router_flags}
;;
esac
case ${ipxrouted_enable} in
[Yy][Ee][Ss])
echo -n ' IPXrouted'
IPXrouted ${ipxrouted_flags} > /dev/null 2>&1
;;
esac
case ${mrouted_enable} in
[Yy][Ee][Ss])
echo -n ' mrouted'; mrouted ${mrouted_flags}
;;
esac
case ${rarpd_enable} in
[Yy][Ee][Ss])
echo -n ' rarpd'; rarpd ${rarpd_flags}
;;
esac
echo '.'
# Let future generations know we made it.
#
network_pass1_done=YES
}
network_pass2() {
echo -n 'Doing additional network setup:'
case ${named_enable} in
[Yy][Ee][Ss])
echo -n ' named'; ${named_program:-named} ${named_flags}
;;
esac
case ${ntpdate_enable} in
[Yy][Ee][Ss])
echo -n ' ntpdate'
${ntpdate_program:-ntpdate} ${ntpdate_flags} >/dev/null 2>&1
;;
esac
case ${ntpd_enable} in
[Yy][Ee][Ss])
echo -n ' ntpd'; ${ntpd_program:-ntpd} ${ntpd_flags}
;;
esac
case ${timed_enable} in
[Yy][Ee][Ss])
echo -n ' timed'; timed ${timed_flags}
;;
esac
case ${rpcbind_enable} in
[Yy][Ee][Ss])
echo -n ' rpcbind'; ${rpcbind_program:-/usr/sbin/rpcbind} \
${rpcbind_flags}
# Start ypserv if we're an NIS server.
# Run rpc.ypxfrd and rpc.yppasswdd only on the NIS master server.
#
case ${nis_server_enable} in
[Yy][Ee][Ss])
echo -n ' ypserv'; ypserv ${nis_server_flags}
case ${nis_ypxfrd_enable} in
[Yy][Ee][Ss])
echo -n ' rpc.ypxfrd'
rpc.ypxfrd ${nis_ypxfrd_flags}
;;
esac
case ${nis_yppasswdd_enable} in
[Yy][Ee][Ss])
echo -n ' rpc.yppasswdd'
rpc.yppasswdd ${nis_yppasswdd_flags}
;;
esac
;;
esac
# Start ypbind if we're an NIS client
#
case ${nis_client_enable} in
[Yy][Ee][Ss])
echo -n ' ypbind'; ypbind ${nis_client_flags}
case ${nis_ypset_enable} in
[Yy][Ee][Ss])
echo -n ' ypset'; ypset ${nis_ypset_flags}
;;
esac
;;
esac
# Start keyserv if we are running Secure RPC
#
case ${keyserv_enable} in
[Yy][Ee][Ss])
echo -n ' keyserv'; keyserv ${keyserv_flags}
;;
esac
# Start ypupdated if we are running Secure RPC
# and we are NIS master
#
case ${rpc_ypupdated_enable} in
[Yy][Ee][Ss])
echo -n ' rpc.ypupdated'; rpc.ypupdated
;;
esac
;;
esac
# Start ATM daemons
if [ -n "${atm_pass2_done}" ]; then
atm_pass3
fi
echo '.'
network_pass2_done=YES
}
network_pass3() {
echo -n 'Starting final network daemons:'
case ${rpcbind_enable} in
[Yy][Ee][Ss])
case ${nfs_server_enable} in
[Yy][Ee][Ss])
# Handle absent nfs server support
nfsserver_in_kernel=0
if sysctl vfs.nfsrv >/dev/null 2>&1; then
nfsserver_in_kernel=1
else
kldload nfsserver && nfsserver_in_kernel=1
fi
if [ -r /etc/exports -a \
${nfsserver_in_kernel} -eq 1 ]; then
echo -n ' mountd'
case ${weak_mountd_authentication} in
[Yy][Ee][Ss])
mountd_flags="${mountd_flags} -n"
;;
esac
mountd ${mountd_flags}
case ${nfs_reserved_port_only} in
[Yy][Ee][Ss])
echo -n ' NFS on reserved port only=YES'
sysctl vfs.nfsrv.nfs_privport=1 > /dev/null
;;
esac
echo -n ' nfsd'; nfsd ${nfs_server_flags}
case ${rpc_statd_enable} in
[Yy][Ee][Ss])
echo -n ' rpc.statd'; rpc.statd
;;
esac
case ${rpc_lockd_enable} in
[Yy][Ee][Ss])
echo -n ' rpc.lockd'; rpc.lockd
;;
esac
else
echo -n ' Warning: nfs server failed'
fi
;;
*)
case ${mountd_enable} in
[Yy][Ee][Ss])
if [ -r /etc/exports ]; then
echo -n ' mountd'
case ${weak_mountd_authentication} in
[Yy][Ee][Ss])
mountd_flags="-n"
;;
esac
mountd ${mountd_flags}
fi
;;
esac
;;
esac
case ${nfs_client_enable} in
[Yy][Ee][Ss])
nfsclient_in_kernel=0
# Handle absent nfs client support
if sysctl vfs.nfs >/dev/null 2>&1; then
nfsclient_in_kernel=1
else
kldload nfsclient && nfsclient_in_kernel=1
fi
if [ ${nfsclient_in_kernel} -eq 1 ]
then
if [ -n "${nfs_access_cache}" ]; then
echo -n " NFS access cache time=${nfs_access_cache}"
sysctl vfs.nfs.access_cache_timeout=${nfs_access_cache} >/dev/null
fi
if [ -n "${nfs_bufpackets}" ]; then
sysctl vfs.nfs.bufpackets=${nfs_bufpackets} > /dev/null
fi
case ${rpc_statd_enable} in
[Yy][Ee][Ss])
echo -n ' rpc.statd'; rpc.statd
;;
esac
case ${rpc_lockd_enable} in
[Yy][Ee][Ss])
echo -n ' rpc.lockd'; rpc.lockd
;;
esac
case ${amd_enable} in
[Yy][Ee][Ss])
echo -n ' amd'
case ${amd_map_program} in
[Nn][Oo] | '')
;;
*)
amd_flags="${amd_flags} `eval\
${amd_map_program}`"
;;
esac
case "${amd_flags}" in
'')
if [ -r /etc/amd.conf ]; then
amd &
else
echo ''
echo 'Warning: amd will not load without arguments'
fi
;;
*)
amd -p ${amd_flags} \
>/var/run/amd.pid \
2>/dev/null &
;;
esac
;;
esac
else
echo 'Warning: NFS client kernel module failed to load'
nfs_client_enable=NO
fi
;;
esac
# If /var/db/mounttab exists, some nfs-server has not been
# successfully notified about a previous client shutdown.
# If there is no /var/db/mounttab, we do nothing.
if [ -f /var/db/mounttab ]; then
rpc.umntall -k
fi
;;
esac
case ${rwhod_enable} in
[Yy][Ee][Ss])
echo -n ' rwhod'; rwhod ${rwhod_flags}
;;
esac
case ${kerberos5_server_enable} in
[Yy][Ee][Ss])
echo -n ' kerberos5'
${kerberos5_server} &
case ${kadmind5_server_enable} in
[Yy][Ee][Ss])
echo -n ' kadmind5'
${kadmind5_server} &
;;
esac
;;
esac
case ${pppoed_enable} in
[Yy][Ee][Ss])
if [ -n "${pppoed_provider}" ]; then
pppoed_flags="${pppoed_flags} -p ${pppoed_provider}"
fi
echo -n ' pppoed';
_opts=$-; set -f
/usr/libexec/pppoed ${pppoed_flags} ${pppoed_interface}
set +f; set -${_opts}
;;
esac
case ${sshd_enable} in
[Yy][Ee][Ss])
if [ -x /usr/bin/ssh-keygen ]; then
if [ ! -f /etc/ssh/ssh_host_key ]; then
echo ' creating ssh1 RSA host key';
/usr/bin/ssh-keygen -t rsa1 -N "" \
-f /etc/ssh/ssh_host_key
fi
if [ ! -f /etc/ssh/ssh_host_rsa_key ]; then
echo ' creating ssh2 RSA host key';
/usr/bin/ssh-keygen -t rsa -N "" \
-f /etc/ssh/ssh_host_rsa_key
fi
if [ ! -f /etc/ssh/ssh_host_dsa_key ]; then
echo ' creating ssh2 DSA host key';
/usr/bin/ssh-keygen -t dsa -N "" \
-f /etc/ssh/ssh_host_dsa_key
fi
fi
;;
esac
echo '.'
network_pass3_done=YES
}
network_pass4() {
echo -n 'Additional TCP options:'
case ${log_in_vain} in
[Nn][Oo] | '')
log_in_vain=0
;;
[Yy][Ee][Ss])
log_in_vain=1
;;
[0-9]*)
;;
*)
echo " invalid log_in_vain setting: ${log_in_vain}"
log_in_vain=0
;;
esac
[ "${log_in_vain}" -ne 0 ] && (
echo -n " log_in_vain=${log_in_vain}"
sysctl net.inet.tcp.log_in_vain="${log_in_vain}" >/dev/null
sysctl net.inet.udp.log_in_vain="${log_in_vain}" >/dev/null
)
echo '.'
network_pass4_done=YES
}
network_gif_setup() {
case ${gif_interfaces} in
[Nn][Oo] | '')
;;
*)
for i in ${gif_interfaces}; do
eval peers=\$gifconfig_$i
case ${peers} in
'')
continue
;;
*)
ifconfig $i create >/dev/null 2>&1
ifconfig $i tunnel ${peers}
ifconfig $i up
;;
esac
done
;;
esac
}
convert_host_conf() {
host_conf=$1; shift;
nsswitch_conf=$1; shift;
awk ' \
/^[:blank:]*#/ { next } \
/(hosts|local|file)/ { nsswitch[c] = "files"; c++; next } \
/(dns|bind)/ { nsswitch[c] = "dns"; c++; next } \
/nis/ { nsswitch[c] = "nis"; c++; next } \
{ printf "Warning: unrecognized line [%s]", $0 > "/dev/stderr" } \
END { \
printf "hosts: "; \
for (i in nsswitch) printf "%s ", nsswitch[i]; \
printf "\n"; \
}' < $host_conf > $nsswitch_conf
}
generate_host_conf() {
nsswitch_conf=$1; shift;
host_conf=$1; shift;
awk '
BEGIN {
xlat["files"] = "hosts";
xlat["dns"] = "bind";
xlat["nis"] = "nis";
cont = 0;
}
sub(/^[\t ]*hosts:/, "") || cont {
if (!cont)
srcs = ""
sub(/#.*/, "")
gsub(/[][]/, " & ")
cont = sub(/\\$/, "")
srcs = srcs " " $0
}
END {
print "# Auto-generated from nsswitch.conf, do not edit"
ns = split(srcs, s)
for (n = 1; n <= ns; ++n) {
if (s[n] in xlat)
print xlat[s[n]]
}
}
' <$nsswitch_conf >$host_conf
}

View File

@ -1,540 +0,0 @@
#! /bin/sh
#
# Copyright (c) 2000 The KAME Project
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
# 1. Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
# 2. Redistributions in binary form must reproduce the above copyright
# notice, this list of conditions and the following disclaimer in the
# documentation and/or other materials provided with the distribution.
#
# THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
# ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
# SUCH DAMAGE.
#
# $FreeBSD$
#
# Note that almost all of the user-configurable behavior is not in this
# file, but rather in /etc/defaults/rc.conf. Please check that file
# first before contemplating any changes here. If you do need to change
# this file for some reason, we would like to know about it.
hexdigit () {
if [ $1 -lt 10 ]; then
echo $1
else
case $1 in
10) echo a ;;
11) echo b ;;
12) echo c ;;
13) echo d ;;
14) echo e ;;
15) echo f ;;
esac
fi
}
hexprint () {
val=$1
str=''
dig=`hexdigit $((${val} & 15))`
str=${dig}${str}
val=$((${val} >> 4))
while [ ${val} -gt 0 ]; do
dig=`hexdigit $((${val} & 15))`
str=${dig}${str}
val=$((${val} >> 4))
done
echo ${str}
}
# IPv6 startup
network6_pass1() {
echo -n 'Doing IPv6 network setup:'
# Initialize IP filtering using ip6fw
#
if /sbin/ip6fw -q flush > /dev/null 2>&1; then
ipv6_firewall_in_kernel=1
else
ipv6_firewall_in_kernel=0
fi
case ${ipv6_firewall_enable} in
[Yy][Ee][Ss])
if [ "${ipv6_firewall_in_kernel}" -eq 0 ] && kldload ip6fw; then
ipv6_firewall_in_kernel=1
echo "Kernel IPv6 firewall module loaded."
elif [ "${ipv6_firewall_in_kernel}" -eq 0 ]; then
echo "Warning: IPv6 firewall kernel module failed to load."
fi
;;
esac
# Load the filters if required
#
case ${ipv6_firewall_in_kernel} in
1)
if [ -z "${ipv6_firewall_script}" ]; then
ipv6_firewall_script=/etc/rc.firewall6
fi
case ${ipv6_firewall_enable} in
[Yy][Ee][Ss])
if [ -r "${ipv6_firewall_script}" ]; then
. "${ipv6_firewall_script}"
echo -n 'IPv6 Firewall rules loaded.'
elif [ "`ip6fw l 65535`" = "65535 deny ipv6 from any to any" ]; then
echo -n "Warning: kernel has IPv6 firewall functionality, "
echo "but IPv6 firewall rules are not enabled."
echo " All ipv6 services are disabled."
fi
case ${ipv6_firewall_logging} in
[Yy][Ee][Ss] | '')
echo 'IPv6 Firewall logging=YES'
sysctl net.inet6.ip6.fw.verbose=1 >/dev/null
;;
*)
;;
esac
;;
esac
;;
esac
case ${ipv6_network_interfaces} in
[Aa][Uu][Tt][Oo])
#
# list of interfaces, and prefix for interfaces
#
ipv6_network_interfaces="`ifconfig -l`"
;;
[Nn][Oo][Nn][Ee])
ipv6_network_interfaces=''
;;
esac
# just to make sure
ifconfig lo0 up
# disallow "internal" addresses to appear on the wire
route add -inet6 ::ffff:0.0.0.0 -prefixlen 96 ::1 -reject
route add -inet6 ::0.0.0.0 -prefixlen 96 ::1 -reject
case ${ipv6_gateway_enable} in
[Yy][Ee][Ss])
# act as a router
sysctl net.inet6.ip6.forwarding=1
sysctl net.inet6.ip6.accept_rtadv=0
# wait for DAD
for i in $ipv6_network_interfaces; do
ifconfig $i up
done
sleep `sysctl -n net.inet6.ip6.dad_count`
sleep 1
;;
*)
# act as endhost - start with manual configuration
# Setup of net.inet6.ip6.accept_rtadv is done later by
# network6_interface_setup.
sysctl net.inet6.ip6.forwarding=0
;;
esac
if [ -n "${ipv6_network_interfaces}" ]; then
# setting up interfaces
network6_interface_setup $ipv6_network_interfaces
# wait for DAD's completion (for global addrs)
sleep `sysctl -n net.inet6.ip6.dad_count`
sleep 1
fi
case ${ipv6_gateway_enable} in
[Yy][Ee][Ss])
# Filter out interfaces on which IPv6 addr init failed.
ipv6_working_interfaces=""
for i in ${ipv6_network_interfaces}; do
laddr=`network6_getladdr $i exclude_tentative`
case ${laddr} in
'')
;;
*)
ipv6_working_interfaces="$i \
${ipv6_working_interfaces}"
;;
esac
done
ipv6_network_interfaces=${ipv6_working_interfaces}
;;
esac
# 6to4 setup
network6_stf_setup
# install the "default interface" to kernel, which will be used
# as the default route when there's no router.
network6_default_interface_setup
# setup static routes
network6_static_routes_setup
# setup faith
network6_faith_setup
# ipv6_router
case ${ipv6_router_enable} in
[Yy][Ee][Ss])
if [ -x ${ipv6_router} ]; then
echo -n " ${ipv6_router}"
${ipv6_router} ${ipv6_router_flags}
fi
;;
esac
case ${ipv6_gateway_enable} in
[Yy][Ee][Ss])
# rtadvd
# This should enabled with a great care.
# You may want to fine-tune /etc/rtadvd.conf.
#
# And if you wish your rtadvd to receive and process
# router renumbering messages, specify your Router Renumbering
# security policy by -R option.
#
# See `man 3 ipsec_set_policy` for IPsec policy specification
# details.
# (CAUTION: This enables your routers prefix renumbering
# from another machine, so if you enable this, do it with
# enough care.)
#
case ${rtadvd_enable} in
[Yy][Ee][Ss])
# default
case ${rtadvd_interfaces} in
'')
for i in ${ipv6_network_interfaces}; do
case $i in
lo0|gif[0-9]*|stf[0-9]*|faith[0-9]*|lp[0-9]*|sl[0-9]*|tun[0-9]*)
continue
;;
*)
rtadvd_interfaces="${rtadvd_interfaces} ${i}"
;;
esac
done
;;
esac
rtadvd ${rtadvd_interfaces}
#
# Enable Router Renumbering, unicast case
# (use correct src/dst addr)
# rtadvd -R "in ipsec ah/transport/fec0:0:0:1::1-fec0:0:0:10::1/require" \
# ${ipv6_network_interfaces}
# Enable Router Renumbering, multicast case
# (use correct src addr)
# rtadvd -R "in ipsec ah/transport/ff05::2-fec0:0:0:10::1/require" \
# ${ipv6_network_interfaces}
;;
esac
# mroute6d
case ${mroute6d_enable} in
[Yy][Ee][Ss])
if [ -x ${mroute6d_program} ]; then
echo -n " ${mroute6d_program}"
${mroute6d_program} ${mroute6d_flags}
fi
;;
esac
;;
esac
case ${ipv6_ipv4mapping} in
[Yy][Ee][Ss])
echo -n ' IPv4 mapped IPv6 address support=YES'
sysctl net.inet6.ip6.v6only=0 >/dev/null
;;
'' | *)
echo -n ' IPv4 mapped IPv6 address support=NO'
sysctl net.inet6.ip6.v6only=1 >/dev/null
;;
esac
echo '.'
# Let future generations know we made it.
#
network6_pass1_done=YES
}
network6_interface_setup() {
interfaces=$*
rtsol_interfaces=''
case ${ipv6_gateway_enable} in
[Yy][Ee][Ss])
rtsol_available=no
;;
*)
rtsol_available=yes
;;
esac
for i in $interfaces; do
rtsol_interface=yes
eval prefix=\$ipv6_prefix_$i
if [ -n "${prefix}" ]; then
rtsol_available=no
rtsol_interface=no
laddr=`network6_getladdr $i`
hostid=`expr "${laddr}" : 'fe80::\(.*\)%\(.*\)'`
for j in ${prefix}; do
address=$j\:${hostid}
ifconfig $i inet6 ${address} prefixlen 64 alias
case ${ipv6_gateway_enable} in
[Yy][Ee][Ss])
# subnet-router anycast address
# (rfc2373)
ifconfig $i inet6 $j:: prefixlen 64 \
alias anycast
;;
esac
done
fi
eval ipv6_ifconfig=\$ipv6_ifconfig_$i
if [ -n "${ipv6_ifconfig}" ]; then
rtsol_available=no
rtsol_interface=no
ifconfig $i inet6 ${ipv6_ifconfig} alias
fi
if [ ${rtsol_available} = yes -a ${rtsol_interface} = yes ]
then
case ${i} in
lo0|gif[0-9]*|stf[0-9]*|faith[0-9]*|lp[0-9]*|sl[0-9]*|tun[0-9]*)
;;
*)
rtsol_interfaces="${rtsol_interfaces} ${i}"
;;
esac
else
ifconfig $i inet6
fi
done
if [ ${rtsol_available} = yes -a -n "${rtsol_interfaces}" ]; then
# Act as endhost - automatically configured.
# You can configure only single interface, as
# specification assumes that autoconfigured host has
# single interface only.
sysctl net.inet6.ip6.accept_rtadv=1
set ${rtsol_interfaces}
ifconfig $1 up
rtsol $1
fi
for i in $interfaces; do
alias=0
while : ; do
eval ipv6_ifconfig=\$ipv6_ifconfig_${i}_alias${alias}
if [ -z "${ipv6_ifconfig}" ]; then
break;
fi
ifconfig $i inet6 ${ipv6_ifconfig} alias
alias=$((${alias} + 1))
done
done
}
network6_stf_setup() {
case ${stf_interface_ipv4addr} in
[Nn][Oo] | '')
;;
*)
# assign IPv6 addr and interface route for 6to4 interface
stf_prefixlen=$((16+${stf_interface_ipv4plen:-0}))
OIFS="$IFS"
IFS=".$IFS"
set ${stf_interface_ipv4addr}
IFS="$OIFS"
hexfrag1=`hexprint $(($1*256 + $2))`
hexfrag2=`hexprint $(($3*256 + $4))`
ipv4_in_hexformat="${hexfrag1}:${hexfrag2}"
case ${stf_interface_ipv6_ifid} in
[Aa][Uu][Tt][Oo] | '')
for i in ${ipv6_network_interfaces}; do
laddr=`network6_getladdr ${i}`
case ${laddr} in
'')
;;
*)
break
;;
esac
done
stf_interface_ipv6_ifid=`expr "${laddr}" : \
'fe80::\(.*\)%\(.*\)'`
case ${stf_interface_ipv6_ifid} in
'')
stf_interface_ipv6_ifid=0:0:0:1
;;
esac
;;
esac
ifconfig stf0 create >/dev/null 2>&1
ifconfig stf0 inet6 2002:${ipv4_in_hexformat}:${stf_interface_ipv6_slaid:-0}:${stf_interface_ipv6_ifid} \
prefixlen ${stf_prefixlen}
# disallow packets to malicious 6to4 prefix
route add -inet6 2002:e000:: -prefixlen 20 ::1 -reject
route add -inet6 2002:7f00:: -prefixlen 24 ::1 -reject
route add -inet6 2002:0000:: -prefixlen 24 ::1 -reject
route add -inet6 2002:ff00:: -prefixlen 24 ::1 -reject
;;
esac
}
network6_static_routes_setup() {
# Set up any static routes.
case ${ipv6_defaultrouter} in
[Nn][Oo] | '')
;;
*)
ipv6_static_routes="default ${ipv6_static_routes}"
ipv6_route_default="default ${ipv6_defaultrouter}"
;;
esac
case ${ipv6_static_routes} in
[Nn][Oo] | '')
;;
*)
for i in ${ipv6_static_routes}; do
eval ipv6_route_args=\$ipv6_route_${i}
route add -inet6 ${ipv6_route_args}
done
;;
esac
}
network6_faith_setup() {
case ${ipv6_faith_prefix} in
[Nn][Oo] | '')
;;
*)
sysctl net.inet6.ip6.keepfaith=1
ifconfig faith0 create >/dev/null 2>&1
ifconfig faith0 up
for prefix in ${ipv6_faith_prefix}; do
prefixlen=`expr "${prefix}" : ".*/\(.*\)"`
case ${prefixlen} in
'')
prefixlen=96
;;
*)
prefix=`expr "${prefix}" : \
"\(.*\)/${prefixlen}"`
;;
esac
route add -inet6 ${prefix} -prefixlen ${prefixlen} ::1
route change -inet6 ${prefix} -prefixlen ${prefixlen} \
-ifp faith0
done
;;
esac
}
network6_default_interface_setup() {
# Choose IPv6 default interface if it is not clearly specified.
case ${ipv6_default_interface} in
'')
for i in ${ipv6_network_interfaces}; do
case $i in
lo0|faith[0-9]*)
continue
;;
esac
laddr=`network6_getladdr $i exclude_tentative`
case ${laddr} in
'')
;;
*)
ipv6_default_interface=$i
break
;;
esac
done
;;
esac
# Disallow unicast packets without outgoing scope identifiers,
# or route such packets to a "default" interface, if it is specified.
route add -inet6 fe80:: -prefixlen 10 ::1 -reject
case ${ipv6_default_interface} in
[Nn][Oo] | '')
route add -inet6 ff02:: -prefixlen 16 ::1 -reject
;;
*)
laddr=`network6_getladdr ${ipv6_default_interface}`
route add -inet6 ff02:: ${laddr} -prefixlen 16 -interface \
-cloning
# Disable installing the default interface with the
# case net.inet6.ip6.forwarding=0 and
# net.inet6.ip6.accept_rtadv=0, due to avoid conflict
# between the default router list and the manual
# configured default route.
case ${ipv6_gateway_enable} in
[Yy][Ee][Ss])
;;
*)
if [ `sysctl -n net.inet6.ip6.accept_rtadv` -eq 1 ]
then
ndp -I ${ipv6_default_interface}
fi
;;
esac
;;
esac
}
network6_getladdr() {
ifconfig $1 2>/dev/null | while read proto addr rest; do
case ${proto} in
inet6)
case ${addr} in
fe80::*)
if [ -z "$2" ]; then
echo ${addr}
return
fi
case ${rest} in
*tentative*)
continue
;;
*)
echo ${addr}
return
esac
esac
esac
done
}

View File

@ -1,56 +0,0 @@
#!/bin/sh -
#
# Copyright (c) 1996 The FreeBSD Project
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
# 1. Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
# 2. Redistributions in binary form must reproduce the above copyright
# notice, this list of conditions and the following disclaimer in the
# documentation and/or other materials provided with the distribution.
#
# THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
# ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
# SUCH DAMAGE.
#
# $FreeBSD$
#
# PC-card startup script
case ${pccard_enable} in
[Yy][Ee][Ss])
echo -n 'Setup PC-CARD:'
case ${pccard_mem} in
[Dd][Ee][Ff][Aa][Uu][Ll][Tt])
pccardc pccardmem 0xd0000 1>/dev/null && echo -n ' memory'
;;
*)
pccardc pccardmem ${pccard_mem} 1>/dev/null && echo -n ' memory'
;;
esac
if [ -n "${pccard_beep}" ] ; then
pccardc beep ${pccard_beep} && echo -n ' beep'
fi
if [ -n "${pccard_conf}" ]; then
pccardd_flags="${pccardd_flags} -f ${pccard_conf}"
fi
pccardd ${pccardd_flags} && echo -n ' pccardd'
echo '.'
;;
esac

View File

@ -1,194 +0,0 @@
#!/bin/sh
#
# Copyright (c) 2002 Gregory Neil Shapiro. All Rights Reserved.
# Copyright (c) 2000, 2002 The FreeBSD Project
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
# 1. Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
# 2. Redistributions in binary form must reproduce the above copyright
# notice, this list of conditions and the following disclaimer in the
# documentation and/or other materials provided with the distribution.
#
# THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
# ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
# SUCH DAMAGE.
#
# $FreeBSD$
#
# This script is used by /etc/rc at boot time to start sendmail. It
# is meant to be sendmail specific and not a generic script for all
# MTAs. It is only called by /etc/rc if the rc.conf mta_start_script is
# set to /etc/rc.sendmail. This provides the opportunity for other MTAs
# to provide their own startup script.
# The script is also used by /etc/mail/Makefile to enable the
# start/stop/restart targets.
# The source for the script can be found in src/etc/sendmail/rc.sendmail.
if [ -r /etc/defaults/rc.conf ]; then
. /etc/defaults/rc.conf
source_rc_confs
elif [ -r /etc/rc.conf ]; then
. /etc/rc.conf
fi
# The sendmail binary
sendmail_program=${sendmail_program:-/usr/sbin/sendmail}
# The pid is used to stop and restart the running daemon(s).
sendmail_pidfile=${sendmail_pidfile:-/var/run/sendmail.pid}
sendmail_mspq_pidfile=${sendmail_mspq_pidfile:-/var/spool/clientmqueue/sm-client.pid}
start_mta()
{
case ${sendmail_enable} in
[Nn][Oo][Nn][Ee])
;;
[Yy][Ee][Ss])
echo -n ' sendmail'
${sendmail_program} ${sendmail_flags}
;;
*)
case ${sendmail_submit_enable} in
[Yy][Ee][Ss])
echo -n ' sendmail-submit'
${sendmail_program} ${sendmail_submit_flags}
;;
*)
case ${sendmail_outbound_enable} in
[Yy][Ee][Ss])
echo -n ' sendmail-outbound'
${sendmail_program} ${sendmail_outbound_flags}
;;
esac
;;
esac
;;
esac
}
stop_mta()
{
if [ -r ${sendmail_pidfile} ]; then
echo -n ' sendmail'
kill -TERM `head -1 ${sendmail_pidfile}`
else
echo "$0: stop-mta: ${sendmail_pidfile} not found"
fi
}
restart_mta()
{
if [ -r ${sendmail_pidfile} ]; then
echo -n ' sendmail'
kill -HUP `head -1 ${sendmail_pidfile}`
else
echo "$0: restart-mta: ${sendmail_pidfile} not found"
fi
}
start_mspq()
{
case ${sendmail_enable} in
[Nn][Oo][Nn][Ee])
;;
*)
if [ -r /etc/mail/submit.cf ]; then
case ${sendmail_msp_queue_enable} in
[Yy][Ee][Ss])
echo -n ' sendmail-clientmqueue'
${sendmail_program} ${sendmail_msp_queue_flags}
;;
esac
fi
;;
esac
}
stop_mspq()
{
if [ -r ${sendmail_mspq_pidfile} ]; then
echo -n ' sendmail-clientmqueue'
kill -TERM `head -1 ${sendmail_mspq_pidfile}`
else
echo "$0: stop-mspq: ${sendmail_mspq_pidfile} not found"
fi
}
restart_mspq()
{
if [ -r ${sendmail_mspq_pidfile} ]; then
echo -n ' sendmail-clientmqueue'
kill -HUP `head -1 ${sendmail_mspq_pidfile}`
else
echo "$0: restart-mspq: ${sendmail_mspq_pidfile} not found"
fi
}
# If no argument is given, assume we are being called at boot time.
_action=${1:-start}
case ${_action} in
start)
start_mta
start_mspq
;;
stop)
stop_mta
stop_mspq
;;
restart)
restart_mta
restart_mspq
;;
start-mta)
start_mta
;;
stop-mta)
stop_mta
;;
restart-mta)
restart_mta
;;
start-mspq)
start_mspq
;;
stop-mspq)
stop_mspq
;;
restart-mspq)
restart_mspq
;;
*)
echo "usage: `basename $0` {start|stop|restart}" >&2
echo " `basename $0` {start-mta|stop-mta|restart-mta}" >&2
echo " `basename $0` {start-mspq|stop-mspq|restart-mspq}" >&2
exit 64
;;
esac
exit 0

View File

@ -1,153 +0,0 @@
#!/bin/sh
#
# Copyright (c) 1996 Andrey A. Chernov
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
# 1. Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
# 2. Redistributions in binary form must reproduce the above copyright
# notice, this list of conditions and the following disclaimer in the
# documentation and/or other materials provided with the distribution.
#
# THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
# ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
# SUCH DAMAGE.
#
# $FreeBSD$
#
# Change some defaults for serial devices.
# Standard defaults are:
# dtrwait 300 drainwait 0
# initial cflag from <sys/ttydefaults.h> = cread cs8 hupcl
# initial iflag, lflag and oflag all 0
# speed 9600
# special chars from <sys/ttydefaults.h>
# nothing locked
# except for serial consoles the initial iflag, lflag and oflag are from
# <sys/ttydefaults.h> and clocal is locked on.
default() {
# Reset everything changed by the other functions to initial defaults.
ci=$1; shift # call in device identifier
co=$1; shift # call out device identifier
for i in $*
do
comcontrol /dev/tty${ci}${i} dtrwait 300 drainwait 300
stty < /dev/ttyi${ci}${i} -clocal crtscts hupcl 9600 reprint ^R
stty < /dev/ttyl${ci}${i} -clocal -crtscts -hupcl 0
stty < /dev/cuai${co}${i} -clocal crtscts hupcl 9600 reprint ^R
stty < /dev/cual${co}${i} -clocal -crtscts -hupcl 0
done
}
maybe() {
# Special settings.
ci=$1; shift
co=$1; shift
for i in $*
do
# Don't use ^R; it breaks bash's ^R when typed ahead.
stty < /dev/ttyi${ci}${i} reprint undef
stty < /dev/cuai${co}${i} reprint undef
# Lock clocal off on dialin device for security.
stty < /dev/ttyl${ci}${i} clocal
# Lock the speeds to use old binaries that don't support them.
# Any legal speed works to lock the initial speed.
stty < /dev/ttyl${ci}${i} 300
stty < /dev/cual${co}${i} 300
done
}
modem() {
# Modem that supports CTS and perhaps RTS handshaking.
ci=$1; shift
co=$1; shift
for i in $*
do
# may depend on modem
comcontrol /dev/tty${ci}${i} dtrwait 100 drainwait 180
# Lock crtscts on.
# Speed reasonable for V42bis.
stty < /dev/ttyi${ci}${i} crtscts 57600
stty < /dev/ttyl${ci}${i} crtscts
stty < /dev/cuai${co}${i} crtscts 57600
stty < /dev/cual${co}${i} crtscts
done
}
mouse() {
# Mouse on either callin or callout port.
ci=$1; shift
co=$1; shift
for i in $*
do
# Lock clocal on, hupcl off.
# Standard speed for Microsoft mouse.
stty < /dev/ttyi${ci}${i} clocal -hupcl 1200
stty < /dev/ttyl${ci}${i} clocal hupcl
stty < /dev/cuai${co}${i} clocal -hupcl 1200
stty < /dev/cual${co}${i} clocal hupcl
done
}
terminal() {
# Terminal that supports CTS and perhaps RTS handshaking
# with the cable or terminal arranged so that DCD is on
# at least while the terminal is on.
# Also works for bidirectional communications to another pc
# provided at most one side runs getty.
# Same as modem() except we want a faster speed and no dtrwait.
ci=$1; shift
co=$1; shift
modem ${ci} ${co} $*
for i in $*
do
comcontrol /dev/tty${ci}${i} dtrwait 0
stty < /dev/ttyi${ci}${i} 115200
stty < /dev/cuai${co}${i} 115200
done
}
# Don't use anything from this file unless you have some buggy programs
# that require it.
# Edit the functions and the examples to suit your system.
# $1 is the call in device identifier, $2 is the call out device identifier
# and the remainder of the line lists the device numbers.
# Initialize assorted 8250-16550 (sio) ports.
# maybe d a 0 1 2 3 4 5 6 7 8 9 a b c d e f g h i j k l m n o p q r s t u v
# mouse d a 2
# modem d a 1
# terminal d a 0
# Initialize all ports on a Cyclades-8yo.
# modem c c 00 01 02 03 04 05 06 07
# Initialize all ports on a Cyclades-16ye.
# modem c c 00 01 02 03 04 05 06 07 08 09 0a 0b 0c 0d 0e 0f
# Initialize all ports on a Digiboard 8.
# modem D D 00 01 02 03 04 05 06 07

View File

@ -1,197 +0,0 @@
#!/bin/sh -
#
# Copyright (c) 2000 The FreeBSD Project
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
# 1. Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
# 2. Redistributions in binary form must reproduce the above copyright
# notice, this list of conditions and the following disclaimer in the
# documentation and/or other materials provided with the distribution.
#
# THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
# ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
# SUCH DAMAGE.
#
# $FreeBSD$
# Do syscons configuration
#
# stdin must be redirected because it might be for a serial console
#
kbddev=/dev/ttyv0
viddev=/dev/ttyv0
# Handle diskless boots, and other situations where syscons is not present
#
if [ -c "${kbddev}" ]; then
echo -n 'Configuring syscons:'
# keymap
#
case ${keymap} in
[Nn][Oo] | '')
;;
*)
echo -n ' keymap'; kbdcontrol < ${kbddev} -l ${keymap}
;;
esac
# keyrate
#
case ${keyrate} in
[Nn][Oo] | '')
;;
*)
echo -n ' keyrate'; kbdcontrol < ${kbddev} -r ${keyrate}
;;
esac
# keybell
#
case ${keybell} in
[Nn][Oo] | '')
;;
*)
echo -n ' keybell'; kbdcontrol < ${kbddev} -b ${keybell}
;;
esac
# change function keys
#
case ${keychange} in
[Nn][Oo] | '')
;;
*)
echo -n ' keychange'
set - ${keychange}
while [ $# -gt 0 ]; do
kbdcontrol <${kbddev} -f "$1" "$2"
shift; shift
done
;;
esac
# cursor type
#
case ${cursor} in
[Nn][Oo] | '')
;;
*)
echo -n ' cursor'; vidcontrol < ${viddev} -c ${cursor}
;;
esac
# screen mapping
#
case ${scrnmap} in
[Nn][Oo] | '')
;;
*)
echo -n ' scrnmap'; vidcontrol < ${viddev} -l ${scrnmap}
;;
esac
# font 8x16
#
case ${font8x16} in
[Nn][Oo] | '')
;;
*)
echo -n ' font8x16'; vidcontrol < ${viddev} -f 8x16 ${font8x16}
;;
esac
# font 8x14
#
case ${font8x14} in
[Nn][Oo] | '')
;;
*)
echo -n ' font8x14'; vidcontrol < ${viddev} -f 8x14 ${font8x14}
;;
esac
# font 8x8
#
case ${font8x8} in
[Nn][Oo] | '')
;;
*)
echo -n ' font8x8'; vidcontrol < ${viddev} -f 8x8 ${font8x8}
;;
esac
# blank time
#
case ${blanktime} in
[Nn][Oo] | '')
;;
*)
echo -n ' blanktime'; vidcontrol < ${viddev} -t ${blanktime}
;;
esac
# screen saver
#
case ${saver} in
[Nn][Oo] | '')
;;
*)
echo -n ' screensaver'
for i in `kldstat | awk '$5 ~ "^splash_.*$" { print $5 }'`; do
kldunload ${i}
done
kldstat -v | grep -q _saver || kldload ${saver}_saver
;;
esac
# mouse daemon
#
case ${moused_enable} in
[Yy][Ee][Ss])
echo -n ' moused'
moused ${moused_flags} -p ${moused_port} -t ${moused_type}
case ${mousechar_start} in
[Nn][Oo] | '')
;;
*)
echo -n ' mousechar_start'; vidcontrol < ${viddev} -M ${mousechar_start}
;;
esac
vidcontrol < ${viddev} -m on
;;
esac
# set this mode for all virtual screens
#
if [ -n "${allscreens_flags}" ]; then
echo -n ' allscreens'
for ttyv in /dev/ttyv*; do
vidcontrol ${allscreens_flags} < ${ttyv} > ${ttyv} 2>&1
done
fi
# set this keyboard mode for all virtual terminals
#
if [ -n "${allscreens_kbdflags}" ]; then
echo -n ' allscreens_kbd'
for ttyv in /dev/ttyv*; do
kbdcontrol ${allscreens_kbdflags} < ${ttyv} > ${ttyv} 2>&1
done
fi
echo '.'
fi

View File

@ -1,61 +0,0 @@
#!/bin/sh
#
# Copyright (c) 1999 Warner Losh
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
# 1. Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer.
# 2. Redistributions in binary form must reproduce the above copyright
# notice, this list of conditions and the following disclaimer in the
# documentation and/or other materials provided with the distribution.
#
# THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
# ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
# SUCH DAMAGE.
#
# $FreeBSD$
#
#
# Read in /etc/sysctl.conf and set things accordingly
#
if [ -f /etc/sysctl.conf ]; then
while read var comments
do
case ${var} in
\#*|'')
;;
*)
mib=${var%=*}
val=${var#*=}
if current_value=`sysctl -n ${mib} 2>/dev/null`; then
case ${current_value} in
${val}) ;;
*)
sysctl ${var}
;;
esac
else
case ${1} in
last)
echo "Warning: sysctl ${mib} does not exist"
;;
esac
fi
;;
esac
done < /etc/sysctl.conf
fi

View File

@ -55,7 +55,7 @@
* doc/en_US.ISO8859-1/books/porters-handbook/book.sgml
*/
#undef __FreeBSD_version
#define __FreeBSD_version 500112 /* Master, propagated to newvers */
#define __FreeBSD_version 500113 /* Master, propagated to newvers */
#ifndef NULL
#define NULL 0