Bring RCNG in from 5.x and adjust config files and scripts accordingly.
authorMatthew Dillon <dillon@dragonflybsd.org>
Thu, 24 Jul 2003 06:35:39 +0000 (06:35 +0000)
committerMatthew Dillon <dillon@dragonflybsd.org>
Thu, 24 Jul 2003 06:35:39 +0000 (06:35 +0000)
Bring in the 5.x mergemaster.
Bring in the 5.x rcorder.
Adjust Makefile's and mtree to deal with /etc/rc.d

Submitted-by: ROBERT GARRETT <rg70@sbcglobal.net>
Additional-work-by: dillon
164 files changed:
etc/Makefile
etc/defaults/rc.conf
etc/etc.alpha/rc.alpha [deleted file]
etc/etc.i386/rc.i386 [deleted file]
etc/mtree/BSD.root.dist
etc/netstart [deleted file]
etc/network.subr [new file with mode: 0644]
etc/pccard_ether
etc/rc
etc/rc.d/DAEMON [new file with mode: 0644]
etc/rc.d/LOGIN [new file with mode: 0644]
etc/rc.d/Makefile [new file with mode: 0644]
etc/rc.d/NETWORKING [new file with mode: 0644]
etc/rc.d/SERVERS [new file with mode: 0644]
etc/rc.d/abi [new file with mode: 0644]
etc/rc.d/accounting [new file with mode: 0644]
etc/rc.d/addswap [new file with mode: 0644]
etc/rc.d/adjkerntz [new file with mode: 0644]
etc/rc.d/altqd [new file with mode: 0644]
etc/rc.d/amd [new file with mode: 0644]
etc/rc.d/apm [new file with mode: 0644]
etc/rc.d/apmd [new file with mode: 0644]
etc/rc.d/archdep [new file with mode: 0644]
etc/rc.d/atm1 [moved from etc/rc.atm with 65% similarity]
etc/rc.d/atm2.sh [new file with mode: 0644]
etc/rc.d/atm3.sh [moved from etc/rc.pccard with 64% similarity]
etc/rc.d/bootconf.sh [new file with mode: 0644]
etc/rc.d/bootparams [new file with mode: 0644]
etc/rc.d/ccd [new file with mode: 0644]
etc/rc.d/cleanvar [new file with mode: 0644]
etc/rc.d/cleartmp [new file with mode: 0644]
etc/rc.d/cron [new file with mode: 0644]
etc/rc.d/dhclient [new file with mode: 0644]
etc/rc.d/dhcpd [new file with mode: 0644]
etc/rc.d/dhcrelay [new file with mode: 0644]
etc/rc.d/diskless [moved from etc/rc.diskless2 with 68% similarity]
etc/rc.d/dmesg [new file with mode: 0644]
etc/rc.d/downinterfaces [new file with mode: 0644]
etc/rc.d/dumpon [new file with mode: 0644]
etc/rc.d/early.sh [new file with mode: 0644]
etc/rc.d/fsck [new file with mode: 0644]
etc/rc.d/gated [new file with mode: 0644]
etc/rc.d/hostname [copied from etc/rc.sysctl with 57% similarity]
etc/rc.d/ifwatchd [new file with mode: 0644]
etc/rc.d/inetd [new file with mode: 0644]
etc/rc.d/initdiskless [moved from etc/rc.diskless1 with 73% similarity]
etc/rc.d/initrandom [new file with mode: 0644]
etc/rc.d/ip6fw [new file with mode: 0644]
etc/rc.d/ipfilter [new file with mode: 0644]
etc/rc.d/ipfs [new file with mode: 0644]
etc/rc.d/ipfw [new file with mode: 0644]
etc/rc.d/ipmon [new file with mode: 0644]
etc/rc.d/ipnat [new file with mode: 0644]
etc/rc.d/ipsec [new file with mode: 0644]
etc/rc.d/ipxrouted [new file with mode: 0644]
etc/rc.d/isdnd [new file with mode: 0644]
etc/rc.d/jail [new file with mode: 0644]
etc/rc.d/kadmind [new file with mode: 0644]
etc/rc.d/kdc [new file with mode: 0644]
etc/rc.d/kerberos [new file with mode: 0644]
etc/rc.d/keyserv [new file with mode: 0644]
etc/rc.d/kldxref [new file with mode: 0644]
etc/rc.d/kpasswdd [new file with mode: 0644]
etc/rc.d/ldconfig [new file with mode: 0644]
etc/rc.d/lkm1 [new file with mode: 0644]
etc/rc.d/lkm2 [new file with mode: 0644]
etc/rc.d/lkm3 [new file with mode: 0644]
etc/rc.d/local [new file with mode: 0644]
etc/rc.d/localdaemons [new file with mode: 0644]
etc/rc.d/lpd [new file with mode: 0644]
etc/rc.d/mixerctl [new file with mode: 0644]
etc/rc.d/mopd [new file with mode: 0644]
etc/rc.d/motd [new file with mode: 0644]
etc/rc.d/mountall [new file with mode: 0644]
etc/rc.d/mountcritlocal [new file with mode: 0644]
etc/rc.d/mountcritremote [new file with mode: 0644]
etc/rc.d/mountd [new file with mode: 0644]
etc/rc.d/moused [new file with mode: 0644]
etc/rc.d/mroute6d [new file with mode: 0644]
etc/rc.d/mrouted [new file with mode: 0644]
etc/rc.d/msgs [new file with mode: 0644]
etc/rc.d/named [new file with mode: 0644]
etc/rc.d/ndbootd [new file with mode: 0644]
etc/rc.d/netif [new file with mode: 0644]
etc/rc.d/netoptions [new file with mode: 0644]
etc/rc.d/network [new file with mode: 0644]
etc/rc.d/network1 [new file with mode: 0644]
etc/rc.d/network2 [new file with mode: 0644]
etc/rc.d/network3 [new file with mode: 0644]
etc/rc.d/network_ipv6 [new file with mode: 0644]
etc/rc.d/newsyslog [new file with mode: 0644]
etc/rc.d/nfsclient [new file with mode: 0644]
etc/rc.d/nfsd [new file with mode: 0644]
etc/rc.d/nfslocking [new file with mode: 0644]
etc/rc.d/nfsserver [new file with mode: 0644]
etc/rc.d/nisdomain [new file with mode: 0644]
etc/rc.d/ntpd [new file with mode: 0644]
etc/rc.d/ntpdate [new file with mode: 0644]
etc/rc.d/othermta [new file with mode: 0644]
etc/rc.d/pccard [copied from etc/rc.sysctl with 58% similarity]
etc/rc.d/pcvt [new file with mode: 0644]
etc/rc.d/poffd [new file with mode: 0644]
etc/rc.d/postfix [new file with mode: 0644]
etc/rc.d/ppp [new file with mode: 0644]
etc/rc.d/ppp-user [new file with mode: 0644]
etc/rc.d/pppoed [new file with mode: 0644]
etc/rc.d/pwcheck [new file with mode: 0644]
etc/rc.d/quota [new file with mode: 0644]
etc/rc.d/racoon [new file with mode: 0644]
etc/rc.d/random [new file with mode: 0644]
etc/rc.d/rarpd [new file with mode: 0644]
etc/rc.d/rbootd [new file with mode: 0644]
etc/rc.d/rcconf.sh [new file with mode: 0644]
etc/rc.d/root [new file with mode: 0644]
etc/rc.d/route6d [new file with mode: 0644]
etc/rc.d/routed [new file with mode: 0644]
etc/rc.d/routing [new file with mode: 0644]
etc/rc.d/rpcbind [new file with mode: 0644]
etc/rc.d/rtadvd [new file with mode: 0644]
etc/rc.d/rtsold [new file with mode: 0644]
etc/rc.d/rwho [new file with mode: 0644]
etc/rc.d/savecore [new file with mode: 0644]
etc/rc.d/screenblank [new file with mode: 0644]
etc/rc.d/securelevel [new file with mode: 0644]
etc/rc.d/sendmail [new file with mode: 0644]
etc/rc.d/serial [moved from etc/rc.serial with 89% similarity]
etc/rc.d/sppp [new file with mode: 0644]
etc/rc.d/sshd [new file with mode: 0644]
etc/rc.d/swap1 [new file with mode: 0644]
etc/rc.d/swap2 [new file with mode: 0644]
etc/rc.d/syscons [new file with mode: 0644]
etc/rc.d/sysctl [new file with mode: 0644]
etc/rc.d/sysdb [new file with mode: 0644]
etc/rc.d/syslogd [new file with mode: 0644]
etc/rc.d/timed [new file with mode: 0644]
etc/rc.d/ttys [new file with mode: 0644]
etc/rc.d/usbd [new file with mode: 0644]
etc/rc.d/vinum [new file with mode: 0644]
etc/rc.d/virecover [new file with mode: 0644]
etc/rc.d/watchdogd [moved from etc/rc.sysctl with 58% similarity]
etc/rc.d/wscons [new file with mode: 0644]
etc/rc.d/xdm [new file with mode: 0644]
etc/rc.d/xfs [new file with mode: 0644]
etc/rc.d/ypbind [new file with mode: 0644]
etc/rc.d/yppasswdd [new file with mode: 0644]
etc/rc.d/ypserv [new file with mode: 0644]
etc/rc.d/ypset [new file with mode: 0644]
etc/rc.d/ypupdated [new file with mode: 0644]
etc/rc.d/ypxfrd [new file with mode: 0644]
etc/rc.isdn [deleted file]
etc/rc.network [deleted file]
etc/rc.network6 [deleted file]
etc/rc.subr [new file with mode: 0644]
etc/rc.syscons [deleted file]
sbin/Makefile
sbin/rcorder/Makefile [new file with mode: 0644]
sbin/rcorder/ealloc.c [new file with mode: 0644]
sbin/rcorder/ealloc.h [new file with mode: 0644]
sbin/rcorder/hash.c [new file with mode: 0644]
sbin/rcorder/hash.h [new file with mode: 0644]
sbin/rcorder/rcorder.8 [new file with mode: 0644]
sbin/rcorder/rcorder.c [new file with mode: 0644]
sbin/rcorder/sprite.h [new file with mode: 0644]
usr.sbin/mergemaster/mergemaster.sh

index df0e53c..3c51947 100644 (file)
@@ -1,6 +1,6 @@
 #      from: @(#)Makefile      5.11 (Berkeley) 5/21/91
 # $FreeBSD: src/etc/Makefile,v 1.219.2.38 2003/03/04 09:49:00 ru Exp $
-# $DragonFly: src/etc/Makefile,v 1.3 2003/06/17 05:14:56 dillon Exp $
+# $DragonFly: src/etc/Makefile,v 1.4 2003/07/24 06:35:32 dillon Exp $
 
 .if !defined(NO_SENDMAIL)
 SUBDIR=        sendmail
@@ -13,21 +13,16 @@ BIN1=       amd.map apmd.conf auth.conf \
        inetd.conf login.access login.conf \
        motd modems networks newsyslog.conf \
        pam.conf phones printcap profile protocols \
-       rc rc.atm rc.diskless1 rc.diskless2 rc.firewall rc.firewall6 \
-       rc.network rc.network6 rc.pccard rc.sendmail rc.serial rc.shutdown \
-       rc.syscons rc.sysctl remote rpc services \
+       rc rc.firewall rc.firewall6 \
+       rc.sendmail rc.shutdown \
+       remote rpc services \
        shells sysctl.conf syslog.conf usbd.conf \
        etc.${MACHINE_ARCH}/disktab \
-       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 \
@@ -38,7 +33,7 @@ SSL=  ${.CURDIR}/../crypto/openssl/apps/openssl.cnf
 .endif
 
 # -rwxr-xr-x root:wheel, for the new cron root:wheel
-BIN2=  netstart pccard_ether rc.suspend rc.resume
+BIN2=  pccard_ether rc.suspend rc.resume
 
 DEFAULTS= rc.conf make.conf pccard.conf periodic.conf
 
@@ -78,6 +73,7 @@ distribution:
        cd ${.CURDIR}/defaults; ${INSTALL} -o ${BINOWN} -g ${BINGRP} -m 644 \
            ${DEFAULTS} ${DESTDIR}/etc/defaults
        cd ${.CURDIR}/periodic; ${MAKE} install
+       cd ${.CURDIR}/rc.d; ${MAKE} install 
        cd ${.CURDIR}/../gnu/usr.bin/send-pr; ${MAKE} etc-gnats-freefall
        cd ${.CURDIR}/../share/termcap; ${MAKE} etc-termcap
        cd ${.CURDIR}/../usr.sbin/rmt; ${MAKE} etc-rmt
index 4169201..273a707 100644 (file)
 #
 # All arguments must be in double or single quotes.
 #
-# $FreeBSD: src/etc/defaults/rc.conf,v 1.53.2.62 2003/02/12 03:56:46 gshapiro Exp $
-# $DragonFly: src/etc/defaults/rc.conf,v 1.2 2003/06/17 04:24:47 dillon Exp $
+# $FreeBSD: src/etc/defaults/rc.conf,v 1.180 2003/06/26 09:50:50 smkelly Exp $
+# $DragonFly: src/etc/defaults/rc.conf,v 1.3 2003/07/24 06:35:35 dillon Exp $
 
 ##############################################################
 ###  Important initial Boot-time options  ####################
 ##############################################################
 
+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
 swapfile="NO"          # Set to name of swapfile if aux swapfile desired.
 apm_enable="NO"                # Set to YES to enable APM BIOS functions (or NO).
 apmd_enable="NO"       # Run apmd to handle APM event from userland.
 apmd_flags=""          # Flags to apmd (if enabled).
+devd_enable="NO"       # Run devd, to trigger programs on device tree changes.
+kldxref_enable="NO"    # Build linker.hints files with kldxref(8).
+kldxref_clobber="NO"   # Overwrite old linker.hints at boot.
+kldxref_module_path="" # Override kern.module_path. A ';'-delimited list.
 pccard_enable="NO"     # Set to YES if you want to configure PCCARD devices.
 pccard_mem="DEFAULT"   # If pccard_enable=YES, this is card memory address.
 pccard_beep="2"                # pccard beep type.
@@ -31,10 +38,14 @@ pccard_ifconfig="NO"        # Specialized pccard ethernet configuration (or NO).
 pccardd_flags="-z"     # Additional flags for pccardd.
 pccard_conf="/etc/defaults/pccard.conf"        # pccardd(8) config file
 pccard_ether_delay="5" # Delay before trying to start dhclient in pccard_ether
+removable_interfaces=""        # Removable network interfaces for /etc/pccard_ether.
 local_startup="/usr/local/etc/rc.d /usr/X11R6/etc/rc.d" # startup script dirs.
 script_name_sep=" "    # Change if your startup scripts' names contain spaces
 rc_conf_files="/etc/rc.conf /etc/rc.conf.local"
 fsck_y_enable="NO"     # Set to YES to do fsck -y if the initial preen fails.
+netfs_types="nfs:NFS smbfs:SMB portalfs:PORTAL nwfs:NWFS" # Net filesystems.
+extra_netfs_types="NO" # List of network extra filesystem types for delayed
+                       # mount at startup (or NO).
 
 ##############################################################
 ###  Network configuration sub-section  ######################
@@ -43,8 +54,8 @@ fsck_y_enable="NO"    # Set to YES to do fsck -y if the initial preen fails.
 ### Basic network and firewall/security options: ###
 hostname=""                    # Set this!
 nisdomainname="NO"             # Set to NIS domain if using NIS (or NO).
-dhcp_program="/sbin/dhclient"  # Path to dhcp client program.
-dhcp_flags=""                  # Additional flags to pass to dhcp client.
+dhclient_program="/sbin/dhclient"      # Path to dhcp client program.
+dhclient_flags=""              # Additional flags to pass to dhcp client.
 firewall_enable="NO"           # Set to YES to enable firewall functionality
 firewall_script="/etc/rc.firewall" # Which script to run to set up the firewall
 firewall_type="UNKNOWN"                # Firewall type (see /etc/rc.firewall)
@@ -115,34 +126,42 @@ syslogd_enable="YES"              # Run syslog daemon (or NO).
 syslogd_program="/usr/sbin/syslogd" # path to syslogd, if you want a different one.
 syslogd_flags="-s"             # Flags to syslogd (if enabled).
 #syslogd_flags="-ss"           # Syslogd flags to not bind an inet socket
-inetd_enable="YES"             # Run the network daemon dispatcher (YES/NO).
+inetd_enable="NO"              # Run the network daemon dispatcher (YES/NO).
 inetd_program="/usr/sbin/inetd"        # path to inetd, if you want a different one.
 inetd_flags="-wW"              # Optional flags to inetd
 #
 # named.  It may be possible to run named in a sandbox, man security for
 # details.
 #
+named_rcng="NO"                        # XXX Temporary. Enable to use new rc
+                               #    functionality in support of named. See
+                               #    variables below.
 named_enable="NO"              # Run named, the DNS server (or NO).
 named_program="/usr/sbin/named"        # path to named, if you want a different one.
-#named_flags="-u bind -g bind" # Flags for named
+named_flags="-u bind -g bind"  # Flags for named
+named_pidfile="/var/run/named/pid" # Pid file
+named_chrootdir=""             # Chroot directory (or "" not to auto-chroot it)
+named_chroot_autoupdate="YES"  # Automatically install/update chrooted
+                               # components of named. See /etc/rc.d/named.
+named_symlink_enable="YES"     # Symlink ${named_pidfile} and /var/run/ndc
+                               # to their chrooted counterparts.
 
 #
 # kerberos. Do not run the admin daemons on slave servers
 #
-kerberos_server_enable="NO"    # Run a kerberos master server (or NO).
-kadmind_server_enable="NO"     # Run kadmind (or NO)
 kerberos5_server_enable="NO"   # Run a kerberos 5 master server (or NO).
 kerberos5_server="/usr/libexec/kdc"    # path to kerberos 5 KDC
 kadmind5_server_enable="NO"    # Run kadmind (or NO)
-kadmind5_server="/usr/libexec/k5admind"        # path to kerberos 5 admin daemon
-kerberos_stash="NO"            # Is the kerberos master key stashed?
+kadmind5_server="/usr/libexec/kadmind" # path to kerberos 5 admin daemon
+kpasswdd_server_enable="NO"    # Run kpasswdd (or NO)
+kpasswdd_server="/usr/libexec/kpasswdd"        # path to kerberos 5 passwd daemon
 
 rwhod_enable="NO"              # Run the rwho daemon (or NO).
 rwhod_flags=""                 # Flags for rwhod
 rarpd_enable="NO"              # Run rarpd (or NO).
 rarpd_flags=""                 # Flags to rarpd.
-xtend_enable="NO"              # Run the X-10 power controller daemon.
-xtend_flags=""                 # Flags to xtend (if enabled).
+bootparamd_enable="NO"         # Run bootparamd (or NO).
+bootparamd_flags=""            # Flags to bootparamd
 pppoed_enable="NO"             # Run the PPP over Ethernet daemon.
 pppoed_provider="*"            # Provider and ppp(8) config file entry.
 pppoed_flags="-P /var/run/pppoed.pid"  # Flags to pppoed (if enabled).
@@ -151,25 +170,26 @@ sshd_enable="NO"          # Enable sshd
 sshd_program="/usr/sbin/sshd"  # path to sshd, if you want a different one.
 sshd_flags=""                  # Additional flags for sshd.
 
-### Network daemon (NFS): All need portmap_enable="YES" ###
+### Network daemon (NFS): All need rpcbind_enable="YES" ###
 amd_enable="NO"                        # Run amd service with $amd_flags (or NO).
 amd_flags="-a /.amd_mnt -l syslog /host /etc/amd.map /net /etc/amd.map"
 amd_map_program="NO"           # Can be set to "ypcat -k amd.master"
 nfs_client_enable="NO"         # This host is an NFS client (or NO).
-nfs_client_flags="-n 4"        # Flags to nfsiod (if enabled).
+nfs_client_flags="-n 4"                # Flags to nfsiod (if enabled).
 nfs_access_cache="2"           # Client cache timeout in seconds
 nfs_server_enable="NO"         # This host is an NFS server (or NO).
 nfs_server_flags="-u -t -n 4"  # Flags to nfsd (if enabled).
-single_mountd_enable="NO"      # Run mountd only (or NO).
+mountd_enable="NO"             # Run mountd (or NO).
 mountd_flags="-r"              # Flags to mountd (if NFS server enabled).
 weak_mountd_authentication="NO"        # Allow non-root mount requests to be served.
 nfs_reserved_port_only="NO"    # Provide NFS only on secure port (or NO).
 nfs_bufpackets=""              # bufspace (in packets) for client
-rpc_lockd_enable="NO"          # Run NFS rpc.lockd (*broken!*) if nfs_server.
-rpc_statd_enable="YES"                 # Run NFS rpc.statd if nfs_server (or NO).
-portmap_enable="NO"            # Run the portmapper service (YES/NO).
-portmap_program="/usr/sbin/portmap"    # path to portmap, if you want a different one.
-portmap_flags=""               # Flags to portmap (if enabled).
+rpc_lockd_enable="NO"          # Run NFS rpc.lockd needed for client/server.
+rpc_statd_enable="NO"          # Run NFS rpc.statd needed for client/server.
+rpcbind_enable="NO"            # Run the portmapper service (YES/NO).
+# this is rpcbind in 5.x
+rpcbind_program="/usr/sbin/portmap"    # path to rpcbind, if you want a different one.
+rpcbind_flags=""               # Flags to rpcbind (if enabled).
 rpc_ypupdated_enable="NO"      # Run if NIS master and SecureRPC (or NO).
 keyserv_enable="NO"            # Run the SecureRPC keyserver (or NO).
 keyserv_flags=""               # Flags to keyserv (if enabled).
@@ -180,11 +200,11 @@ timed_flags=""                    # Flags to timed (if enabled).
 ntpdate_enable="NO"            # Run ntpdate to sync time on boot (or NO).
 ntpdate_program="/usr/sbin/ntpdate"    # path to ntpdate, if you want a different one.
 ntpdate_flags="-b"             # Flags to ntpdate (if enabled).
-xntpd_enable="NO"              # Run ntpd Network Time Protocol (or NO).
-xntpd_program="/usr/sbin/ntpd" # path to ntpd, if you want a different one.
-xntpd_flags="-p /var/run/ntpd.pid"     # Flags to ntpd (if enabled).
+ntpd_enable="NO"               # Run ntpd Network Time Protocol (or NO).
+ntpd_program="/usr/sbin/ntpd"  # path to ntpd, if you want a different one.
+ntpd_flags="-p /var/run/ntpd.pid"      # Flags to ntpd (if enabled).
 
-# Network Information Services (NIS) options: All need portmap_enable="YES" ###
+# Network Information Services (NIS) options: All need rpcbind_enable="YES" ###
 nis_client_enable="NO"         # We're an NIS client (or NO).
 nis_client_flags=""            # Flags to ypbind (if enabled).
 nis_ypset_enable="NO"          # Run ypset at boot time (or NO).
@@ -285,7 +305,7 @@ stf_interface_ipv6_slaid="0000"     # IPv6 Site Level Aggregator for stf0
 ipv6_faith_prefix="NO"         # Set faith prefix to enable a FAITH
                                # IPv6-to-IPv4 TCP translator.  You also need
                                # faithd(8) setup.
-ipv6_ipv4mapping="YES"         # Set to "NO" to disable IPv4 mapped IPv6 addr
+ipv6_ipv4mapping="NO"          # Set to "YES" to enable IPv4 mapped IPv6 addr
                                # communication. (like ::ffff:a.b.c.d)
 ipv6_firewall_enable="NO"      # Set to YES to enable IPv6 firewall
                                # functionality
@@ -304,7 +324,7 @@ ipv6_ipfilter_rules="/etc/ipf6.rules"       # rules definition file for ipfilter,
 
 keymap="NO"            # keymap in /usr/share/syscons/keymaps/* (or NO).
 keyrate="NO"           # keyboard rate to: slow, normal, fast (or NO).
-keybell="NO"           # bell to duration.pitch or normal or visual (or NO).
+keybell="NO"           # See kbdcontrol(1) for options.  Use "off" to disable.
 keychange="NO"         # function keys default values (or NO).
 cursor="NO"            # cursor type {normal|blink|destructive} (or NO).
 scrnmap="NO"           # screen map in /usr/share/syscons/scrnmaps/* (or NO).
@@ -312,18 +332,36 @@ font8x16="NO"             # font 8x16 from /usr/share/syscons/fonts/* (or NO).
 font8x14="NO"          # font 8x14 from /usr/share/syscons/fonts/* (or NO).
 font8x8="NO"           # font 8x8 from /usr/share/syscons/fonts/* (or NO).
 blanktime="300"                # blank time (in seconds) or "NO" to turn it off.
-saver="NO"             # screen saver: Uses /modules/${saver}_saver.ko
+saver="NO"             # screen saver: Uses /boot/kernel/${saver}_saver.ko
 moused_enable="NO"     # Run the mouse daemon.
 moused_type="auto"     # See man page for rc.conf(5) for available settings.
 moused_port="/dev/psm0"        # Set to your mouse port.
 moused_flags=""                # Any additional flags to moused.
-mousechar_start="NO"   # if 0xd0-0xd3 default range is occuped in your
+mousechar_start="NO"   # if 0xd0-0xd3 default range is occupied in your
                        # language code table, specify alternative range
                        # start like mousechar_start=3, see vidcontrol(1)
 allscreens_flags=""    # Set this vidcontrol mode for all virtual screens
 allscreens_kbdflags="" # Set this kbdcontrol mode for all virtual screens
 
 
+##############################################################
+###  pcvt console driver options  ############################
+##############################################################
+
+pcvt_verbose="NO"      # set to YES to enable verbose configuration messages
+pcvt_keymap="NO"       # keyboard map in /usr/share/misc/keycap.pcvt (or NO).
+pcvt_keydel="NO"       # key repeat delay, 0-3 (250,500,750,1000 msec) (or NO).
+pcvt_keyrate="NO"      # keyboard repetition rate 31-0 (2-30 char/sec) (or NO).
+pcvt_keyrepeat="NO"    # keyboard repeat ON or OFF (or NO).
+pcvt_force24="NO"      # force a 24 line display (when 25 possible) (or NO).
+pcvt_hpext="NO"                # use HP extensions (function keys labels) (or NO).
+pcvt_lines="NO"                # lines (25, 28, 40, 50 or NO).
+pcvt_blanktime="NO"    # blank time (in seconds) (or NO).
+pcvt_cursorh="NO"      # cursor top scanline (topmost line is 0) (or NO).
+pcvt_cursorl="NO"      # cursor low scanline (bottom line is 16) (or NO).
+pcvt_monohigh="NO"     # set intensity to high on monochrome monitors (or NO).
+
+
 ##############################################################
 ###  Mail Transfer Agent (MTA) options  ######################
 ##############################################################
@@ -331,8 +369,7 @@ allscreens_kbdflags=""      # Set this kbdcontrol mode for all virtual screens
 mta_start_script="/etc/rc.sendmail"
                        # Script to start your chosen MTA, called by /etc/rc.
 # Settings for /etc/rc.sendmail:
-sendmail_enable="YES"  # Run the sendmail inbound daemon (YES/NO/NONE).
-                       # If NONE, don't start any sendmail processes.
+sendmail_enable="NO"   # Run the sendmail inbound daemon (YES/NO).
 sendmail_flags="-L sm-mta -bd -q30m" # Flags to sendmail (as a server)
 sendmail_submit_enable="YES"   # Start a localhost-only MTA for mail submission
 sendmail_submit_flags="-L sm-mta -bd -q30m -ODaemonPortOptions=Addr=localhost"
@@ -364,10 +401,10 @@ check_quotas="YES"        # Check quotas on startup (or NO).
 accounting_enable="NO" # Turn on process accounting (or NO).
 ibcs2_enable="NO"      # Ibcs2 (SCO) emulation loaded at startup (or NO).
 ibcs2_loaders="coff"   # List of additional Ibcs2 loaders (or NO).
+sysvipc_enable="NO"    # Load System V IPC primitives at startup (or NO).
 linux_enable="NO"      # Linux binary compatibility loaded at startup (or NO).
 svr4_enable="NO"       # SysVR4 emulation loaded at startup (or NO).
 osf1_enable="NO"       # Alpha OSF/1 emulation loaded at startup (or NO).
-rand_irqs="NO"                 # Stir the entropy pool (like "5 11" or NO).
 clear_tmp_enable="NO"  # Clear /tmp at startup.
 ldconfig_insecure="NO" # Set to YES to disable ldconfig security checks
 ldconfig_paths="/usr/lib/compat /usr/X11R6/lib /usr/local/lib"
@@ -376,9 +413,25 @@ ldconfig_paths_aout="/usr/lib/compat/aout /usr/X11R6/lib/aout /usr/local/lib/aou
                        # a.out shared library search paths
 kern_securelevel_enable="NO"   # kernel security level (see init(8)),
 kern_securelevel="-1"  # range: -1..3 ; `-1' is the most insecure
+lomac_enable="NO"      # start lomac(4) security module at boot
 update_motd="YES"      # update version info in /etc/motd (or NO)
 start_vinum="NO"       # set to YES to start vinum
 unaligned_print="YES"  # print unaligned access warnings on the alpha (or NO).
+entropy_file="/entropy"        # Set to NO to disable caching entropy through reboots.
+                       # /var/db/entropy is preferred if / is not available.
+entropy_dir="/var/db/entropy" # Set to NO to disable caching entropy via cron.
+entropy_save_sz="2048" # Size of the entropy cache files.
+entropy_save_num="8"   # Number of entropy cache files to save.
+harvest_interrupt="YES"        # Entropy device harvests interrupt randomness
+harvest_ethernet="YES" # Entropy device harvests ethernet randomness
+harvest_p_to_p="YES"   # Entropy device harvests point-to-point randomness
+dmesg_enable="YES"     # Save dmesg(8) to /var/run/dmesg.boot
+jail_enable="NO"       # Set to NO to disable starting of any jails
+jail_list=""           # Space separated list of names of jails
+jail_set_hostname_allow="YES" # Allow root user in a jail to change its hostname
+jail_socket_unixiproute_only="YES" # Route only TCP/IP within a jail
+jail_sysvipc_allow="NO"       # Allow SystemV IPC use from within a jail
+watchdogd_enable="NO"  # Start the software watchdog daemon
 
 ##############################################################
 ### Define source_rc_confs, the mechanism used by /etc/rc.* ##
diff --git a/etc/etc.alpha/rc.alpha b/etc/etc.alpha/rc.alpha
deleted file mode 100644 (file)
index fc1ff6b..0000000
+++ /dev/null
@@ -1,29 +0,0 @@
-#!/bin/sh -
-#
-# $FreeBSD: src/etc/etc.alpha/rc.alpha,v 1.7.2.5 2001/12/19 17:52:18 ru Exp $
-# $DragonFly: src/etc/etc.alpha/Attic/rc.alpha,v 1.2 2003/06/17 04:24:47 dillon Exp $
-#      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 '.'
diff --git a/etc/etc.i386/rc.i386 b/etc/etc.i386/rc.i386
deleted file mode 100644 (file)
index ad3a148..0000000
+++ /dev/null
@@ -1,69 +0,0 @@
-#!/bin/sh -
-#
-# $FreeBSD: src/etc/etc.i386/rc.i386,v 1.51.2.5 2001/02/27 20:03:30 jhb Exp $
-# $DragonFly: src/etc/etc.i386/Attic/rc.i386,v 1.2 2003/06/17 04:24:47 dillon Exp $
-#      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
-
-case ${xtend_enable} in
-[Yy][Ee][Ss])
-       echo -n ' xtend';       /usr/libexec/xtend
-       ;;
-esac
-
-echo '.'
-
-# interrupts for /dev/random device
-#
-case ${rand_irqs} in
-[Nn][Oo] | '')
-        ;;
-*)
-       echo -n 'entropy IRQs:'
-       for irq in ${rand_irqs}; do
-               echo -n " ${irq}" && rndcontrol -q -s ${irq}
-       done
-       echo '.'
-       ;;
-esac
index 5b383b6..2133d48 100644 (file)
@@ -1,5 +1,5 @@
 # $FreeBSD: src/etc/mtree/BSD.root.dist,v 1.45.2.4 2002/06/10 15:33:27 obrien Exp $
-# $DragonFly: src/etc/mtree/BSD.root.dist,v 1.2 2003/06/17 04:24:48 dillon Exp $
+# $DragonFly: src/etc/mtree/BSD.root.dist,v 1.3 2003/07/24 06:35:36 dillon Exp $
 #
 # Please see the file src/etc/mtree/README before making changes to this file.
 #
@@ -49,6 +49,8 @@
         ..
         ppp
         ..
+       rc.d
+       ..
         skel
         ..
         ssh
diff --git a/etc/netstart b/etc/netstart
deleted file mode 100644 (file)
index 3d43597..0000000
+++ /dev/null
@@ -1,75 +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: src/etc/netstart,v 1.54.2.5 2001/08/01 19:45:36 obrien Exp $
-# $DragonFly: src/etc/Attic/netstart,v 1.2 2003/06/17 04:24:45 dillon Exp $
-#      From: @(#)netstart      5.9 (Berkeley) 3/30/91
-#
-
-# This file is NOT called by any of the other scripts - it has been
-# obsoleted by /etc/rc.network and is provided here only for user
-# convenience (if you're sitting in single user mode and wish to start
-# the network by hand, this script will do it for you).
-#
-
-# If there is a global system configuration file, suck it in.
-if [ -f /etc/defaults/rc.conf ]; then
-       . /etc/defaults/rc.conf
-       source_rc_confs
-elif [ -f /etc/rc.conf ]; then
-       . /etc/rc.conf
-fi
-
-# Start pccard if necessary
-if [ -r /etc/rc.pccard ]; then
-       . /etc/rc.pccard
-fi
-
-if [ -r /etc/rc.network ]; then
-       . /etc/rc.network
-else
-       echo 'Sorry, I cannot find /etc/rc.network - aborting'
-       exit 1
-fi
-
-echo 'Doing stage one network startup:'
-network_pass1
-
-case ${ipv6_enable} in
-[Yy][Ee][Ss])
-       if [ -r /etc/rc.network6 ]; then
-               . /etc/rc.network6
-       else
-               echo 'Sorry, I cannot find /etc/rc.network6 - aborting'
-               exit 1
-       fi
-
-       echo 'Doing stage one network6 startup:'
-       network6_pass1
-       ;;
-esac
-
-exit 0
diff --git a/etc/network.subr b/etc/network.subr
new file mode 100644 (file)
index 0000000..452da13
--- /dev/null
@@ -0,0 +1,608 @@
+#
+# Copyright (c) 2003 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 PROJECT 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 PROJECT 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: src/etc/network.subr,v 1.151 2003/06/24 03:55:21 kuriyama Exp $
+# $DragonFly: src/etc/network.subr,v 1.1 2003/07/24 06:35:32 dillon Exp $
+#
+
+#
+# Subroutines commonly used from network startup scripts.
+# Requires that rc.conf be loaded first.
+#
+
+# ifconfig_up if
+#      Evaluate ifconfig(8) arguments for interface $if and
+#      run ifconfig(8) with those arguments. It returns 0 if
+#      arguments were found and executed or 1 if the interface
+#      had no arguments.
+#
+ifconfig_up()
+{
+       eval ifconfig_args=\$ifconfig_$1
+       if [ -n "${ifconfig_args}" ]; then
+               ifconfig $1 ${ifconfig_args}
+               return 0
+       fi
+       return 1
+}
+
+# ifconfig_down if
+#      Remove all inet entries from the $if interface. It returns
+#      0 if inet entries were found and removed. It returns 1 if
+#      no entries were found or they could not be removed.
+#
+ifconfig_down()
+{
+       [ -z "$1" ] && return 1
+       _ifs="^"
+       _ret=1
+
+       inetList="`ifconfig $1 | grep 'inet ' | tr "\n" "$_ifs"`"
+
+       oldifs="$IFS"
+       IFS="$_ifs"
+       for _inet in $inetList ; do
+               # get rid of extraneous line
+               [ -z "$_inet" ] && break
+
+               _inet=`expr "$_inet" : '.*\(inet \([0-9]\{1,3\}\.\)\{3\}[0-9]\{1,3\}\).*'`
+
+               IFS="$oldifs"
+               ifconfig $1 ${_inet} delete
+               IFS="$_ifs"
+               _ret=0
+       done
+       IFS="$oldifs"
+
+       return $_ret
+}
+
+# ifalias_up if
+#      Configure aliases for network interface $if.
+#      It returns 0 if at least one alias was configured or
+#      1 if there were none.
+#
+ifalias_up()
+{
+       _ret=1
+       alias=0
+       while : ; do
+               eval ifconfig_args=\$ifconfig_$1_alias${alias}
+               if [ -n "${ifconfig_args}" ]; then
+                       ifconfig $1 ${ifconfig_args} alias
+                       alias=$((${alias} + 1))
+                       _ret=0
+               else
+                       break
+               fi
+       done
+       return $_ret
+}
+
+#ifalias_down if
+#      Remove aliases for network interface $if.
+#      It returns 0 if at least one alias was removed or
+#      1 if there were none.
+#
+ifalias_down()
+{
+       _ret=1
+       alias=0
+       while : ; do
+               eval ifconfig_args=\$ifconfig_$1_alias${alias}
+               if [ -n "${ifconfig_args}" ]; then
+                       ifconfig $1 ${ifconfig_args} -alias
+                       alias=$((${alias} + 1))
+                       _ret=0
+               else
+                       break
+               fi
+       done
+       return $_ret
+}
+
+# ifscript_up if
+#      Evaluate a startup script for the $if interface.
+#      It returns 0 if a script was found and processed or
+#      1 if no script was found.
+#
+ifscript_up()
+{
+       if [ -r /etc/start_if.$1 ]; then
+               . /etc/start_if.$1
+               return 0
+       fi
+       return 1
+}
+
+# ifscript_down if
+#      Evaluate a shutdown script for the $if interface.
+#      It returns 0 if a script was found and processed or
+#      1 if no script was found.
+#
+ifscript_down()
+{
+       if [ -r /etc/stop_if.$1 ]; then
+               . /etc/stop_if.$1
+               return 0
+       fi
+       return 1
+}
+
+# Create cloneable interfaces.
+#
+clone_up()
+{
+       _prefix=
+       _list=
+       for ifn in ${cloned_interfaces}; do
+               ifconfig ${ifn} create
+               if [ $? -eq 0 ]; then
+                       _list="${_list}${_prefix}${ifn}"
+                       [ -z "$_prefix" ] && _prefix=' '
+               fi
+       done
+       debug "Cloned: ${_list}"
+}
+
+# Destroy cloned interfaces. Destroyed interfaces are echoed
+# to standard output.
+#
+clone_down()
+{
+       _prefix=
+       _list=
+       for ifn in ${cloned_interfaces}; do
+               ifconfig ${ifn} destroy
+               if [ $? -eq 0 ]; then
+                       _list="${_list}${_prefix}${ifn}"
+                       [ -z "$_prefix" ] && _prefix=' '
+               fi
+       done
+       debug "Destroyed clones: ${_list}"
+}
+
+gif_up() {
+       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
+}
+
+#
+# ipx_up ifn
+# Configure any IPX addresses for interface $ifn. Returns 0 if IPX
+# arguments were found and configured; returns 1 otherwise.
+#
+ipx_up()
+{
+       ifn="$1"
+       eval ifconfig_args=\$ifconfig_${ifn}_ipx
+       if [ -n "${ifconfig_args}" ]; then
+               ifconfig ${ifn} ${ifconfig_args}
+               return 0
+       fi
+       return 1
+}
+
+# ipx_down ifn
+#      Remove IPX addresses for interface $ifn. Returns 0 if IPX
+#      addresses were found and unconfigured. It returns 1, otherwise.
+#
+ipx_down()
+{
+       [ -z "$1" ] && return 1
+       _ifs="^"
+       _ret=1
+
+       ipxList="`ifconfig $1 | grep 'ipx ' | tr "\n" "$_ifs"`"
+
+       oldifs="$IFS"
+       IFS="$_ifs"
+       for _ipx in $ipxList ; do
+               # get rid of extraneous line
+               [ -z "$_ipx" ] && break
+
+               _ipx=`expr "$_ipx" : '.*\(ipx [0-9a-h]\{1,8\}H*\.[0-9a-h]\{1,12\}\).*'`
+
+               IFS="$oldifs"
+               ifconfig $1 ${_ipx} delete
+               IFS="$_ifs"
+               _ret=0
+       done
+       IFS="$oldifs"
+
+       return $_ret
+}
+
+#
+# list_net_interfaces type
+#      List all network interfaces. The type of interface returned
+#      can be controlled by the type argument. The type
+#      argument can be any of the following:
+#              nodhcp - all interfaces, excluding DHCP configured interfaces
+#              dhcp   - list only DHCP configured interfaces
+#      If no argument is specified all network interfaces are output.
+#      Note that the list always includes cloned interfaces.
+#
+list_net_interfaces()
+{
+       type=$1
+
+       # Get a list of ALL the interfaces
+       #
+       case ${network_interfaces} in
+       [Aa][Uu][Tt][Oo])
+               _tmplist="`ifconfig -l`"
+               ;;
+       *)
+               _tmplist="${network_interfaces}"
+               ;;
+       esac
+       _tmplist="${_tmplist} ${cloned_interfaces}"
+
+       if [ -z "$type" ]; then
+               echo $_tmplist
+               return 0
+       fi
+
+       # Separate out dhcp and non-dhcp intefraces
+       #
+       _aprefix=
+       _brefix=
+       for _if in ${_tmplist} ; do
+               eval _ifarg="\$ifconfig_${_if}"
+               case "$_ifarg" in
+               [Dd][Hh][Cc][Pp])
+                       _dhcplist="${_dhcplist}${_aprefix}${_if}"
+                       [ -z "$_aprefix" ] && _aprefix=' '
+                       ;;
+               ''|*)
+                       _nodhcplist="${_nodhcplist}${_bprefix}${_if}"
+                       [ -z "$_bprefix" ] && _bprefix=' '
+                       ;;
+               esac
+       done
+
+       case "$type" in
+       nodhcp)
+               echo $_nodhcplist
+               ;;
+       dhcp)
+               echo $_dhcplist
+               ;;
+       esac
+       return 0                        
+}
+
+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}
+}
+
+# Setup the interfaces for IPv6
+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
+}
+
+# Setup IPv6 to IPv4 mapping
+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
+}
+
+# Setup static routes
+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
+}
+
+# Setup faith
+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
+}
+
+# Install the "default interface" to kernel, which will be used
+# as the default route when there's no router.
+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
+}
index a2ffa2c..582b518 100644 (file)
@@ -1,7 +1,7 @@
 #!/bin/sh -
 #
 # $FreeBSD: src/etc/pccard_ether,v 1.15.2.10 2001/09/14 17:28:11 imp Exp $
-# $DragonFly: src/etc/pccard_ether,v 1.2 2003/06/17 04:24:45 dillon Exp $
+# $DragonFly: src/etc/pccard_ether,v 1.3 2003/07/24 06:35:32 dillon Exp $
 #
 # pccard_ether interfacename [start|stop] [ifconfig option]
 #
@@ -22,14 +22,23 @@ stop_dhcp() {
 
 start_dhcp() {
        stop_dhcp
-       if [ -x "${dhcp_program}" ]; then
-               if [ `basename ${dhcp_program}` = "dhclient" ]; then
+       case ${pccard_ether_delay} in
+       [Nn][Oo])
+               ;;
+       [0-9])
+               sleep ${pccard_ether_delay}
+               ;;
+       esac
+       [ -n "$dhcp_program" ] && dhclient_program="$dhcp_program"
+       [ -n "$dhcp_flags" ] && dhclient_flags="$dhcp_flags"
+       if [ -x "${dhclient_program}" ]; then
+               if [ `basename ${dhclient_program}` = "dhclient" ]; then
                        pidfile="/var/run/dhclient.${interface}.pid"
-                       dhcp_flags="${dhcp_flags} -pf ${pidfile}"
+                       dhclient_flags="${dhcp_flags} -pf ${pidfile}"
                fi
-               ${dhcp_program} ${dhcp_flags} ${interface}
+               ${dhclient_program} ${dhcp_flags} ${interface}
        else
-               echo "${dhcp_program}: DHCP client software not available"
+               echo "${dhclient_program}: DHCP client software not available"
        fi
 }
 
@@ -47,19 +56,9 @@ shift
 startstop=$1
 shift
 
-case ${pccard_ether_delay} in
-[Nn][Oo])
-       ;;
-[0-9])
-       sleep ${pccard_ether_delay}
-       ;;
-*)     # Default until it has had a chance to make it to /etc/defaults/rc.conf
-       sleep 5
-       ;;
-esac
-
 case ${pccard_ifconfig} in
 [Nn][Oo] | '')
+       expr "${removable_interfaces}" : ".*${interface}" > /dev/null || exit 0
        ;;
 *)
        # Backward compatible
@@ -69,6 +68,11 @@ esac
 
 case ${startstop} in
 [Ss][Tt][Aa][Rr][Tt] | '')
+       if ifconfig ${interface} | grep -s UP, > /dev/null 2>&1; then
+               # Interface is already up, so ignore it.
+               exit 0
+       fi
+
        if [ -r /etc/start_if.${interface} ]; then
                . /etc/start_if.${interface}
        fi
@@ -133,8 +137,8 @@ case ${startstop} in
        # IPv6 setup
        case ${ipv6_enable} in
        [Yy][Ee][Ss])
-               if [ -r /etc/rc.network6 ]; then
-                       . /etc/rc.network6
+               if [ -r /etc/network.subr ]; then
+                       . /etc/network.subr
                        network6_interface_setup ${interface}
                fi
                ;;
@@ -155,7 +159,7 @@ case ${startstop} in
                stop_dhcp
                ;;
        *)
-               # Delelte static route if specified
+               # Delete static route if specified
                eval ifx_routes=\$static_routes_${interface}
                if [ -n "${ifx_routes}" ]; then
                        for i in ${ifx_routes}; do
@@ -179,8 +183,18 @@ case ${startstop} in
                ;;
        esac
 
-       # Remove the network interface and clean the ARP table
+       # Remove the network interface and cleaning the ARP table
        ifconfig ${interface} delete
        arp -d -a
+       
+       # Clean the routing table
+       case ${removable_route_flush} in
+       [Nn][Oo])
+               ;;
+       *)      
+               # flush beforehand, just in case....
+               route -n flush -inet
+               ;;
+       esac
        ;;
 esac
diff --git a/etc/rc b/etc/rc
index 9197dd6..3338b12 100644 (file)
--- a/etc/rc
+++ b/etc/rc
@@ -25,8 +25,8 @@
 # SUCH DAMAGE.
 #
 #      @(#)rc  5.27 (Berkeley) 6/5/91
-# $FreeBSD: src/etc/rc,v 1.212.2.51 2002/10/17 17:25:07 schweikh Exp $
-# $DragonFly: src/etc/rc,v 1.2 2003/06/17 04:24:45 dillon Exp $
+# $FreeBSD: src/etc/rc,v 1.329 2003/05/02 05:27:33 dougb Exp $
+# $DragonFly: src/etc/rc,v 1.3 2003/07/24 06:35:32 dillon Exp $
 #
 
 # System startup script run by init on autoboot
@@ -47,703 +47,32 @@ stty status '^T'
 trap : 2
 trap : 3       # shouldn't be needed
 
-bootmode=$1
-
 HOME=/
 PATH=/sbin:/bin:/usr/sbin:/usr/bin
 export HOME PATH
 
-# BOOTP diskless boot.  We have to run the rc file early in order to
-# retarget various config files.
-# See /usr/share/examples/diskless/clone_root for details on how
-# to setup diskless on the client and the server.
-#
-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
+. /etc/rc.subr
 
-# If there is a global system configuration file, suck it in.
+# 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 [ -r /etc/defaults/rc.conf ]; then
-       . /etc/defaults/rc.conf
-       source_rc_confs
-elif [ -r /etc/rc.conf ]; then
-       . /etc/rc.conf
-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        portmap portmap_enable
-chkdepend amd amd_enable        NFS nfs_client_enable
-chkdepend NFS nfs_server_enable portmap portmap_enable
-chkdepend NIS nis_server_enable portmap portmap_enable
-chkdepend NIS nis_client_enable portmap portmap_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
-
-# 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...'
-       fsck -p
-       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 file system check failed . . . help!'
-                               exit 1
-                               ;;
-                       esac
-                       ;;
-               *)
-                       echo 'Automatic file system 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
-
-# If using diskless, run custom disk mounting function here
-#
-if [ -n "${diskless_mount}" -a -r "${diskless_mount}" ]; then
-       sh ${diskless_mount}
+if [ "$1" = autoboot ]; then
+       autoboot=yes
+       _boot="faststart"
+       rc_fast=yes        # run_rc_command(): do fast booting
 else
-# otherwise mount everything except nfs filesystems.
-       mount -a -t nonfs
-fi
-
-case $? in
-0)
-       ;;
-*)
-       echo 'Mounting /etc/fstab filesystems failed, startup aborted'
-       exit 1
-       ;;
-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/vn0b ]; then
-               echo "Adding ${swapfile} as additional swap"
-               vnconfig -e /dev/vn0b ${swapfile} swap
-       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
-#
-case "`mount -d -a -t nfs 2> /dev/null`" in
-*mount_nfs*)
-       echo -n 'Mounting NFS file systems:'
-       mount -a -t nfs
-       echo '.'
-       ;;
-esac
-
-# If we booted a special kernel remove the record so we will boot
-# the default kernel next time
-#
-rm -f /boot/nextboot.conf
-
-# 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.
-
-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 devices database
-#
-dev_mkdb
-
-# $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
+       autoboot=no
+       _boot="start"
 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
+os=`eval ${CMD_OSTYPE}`
+files=`rcorder -k ${os} -s nostart /etc/rc.d/* 2>/dev/null`
 
-       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
-       case `/usr/bin/objformat` in
-       elf)
-               _LDC=/usr/lib
-               for i in ${ldconfig_paths}; do
-                       if [ -d "${i}" ]; then
-                               _LDC="${_LDC} ${i}"
-                       fi
-               done
-               echo 'ELF ldconfig path:' ${_LDC}
-               ${ldconfig} -elf ${_LDC}
-               ;;
-       esac
-
-       # 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
-
-# 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:'
-
-# 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 streams > /dev/null 2>&1
-       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 file systems 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
+for _rc_elem in ${files}; do
+       run_rc_script ${_rc_elem} ${_boot}
+done
 
 echo ''
-
 date
-
 exit 0
-
diff --git a/etc/rc.d/DAEMON b/etc/rc.d/DAEMON
new file mode 100644 (file)
index 0000000..96349cc
--- /dev/null
@@ -0,0 +1,13 @@
+#!/bin/sh
+#
+# $NetBSD: DAEMON,v 1.8 2002/03/22 04:33:57 thorpej Exp $
+# $FreeBSD: src/etc/rc.d/DAEMON,v 1.3 2002/10/12 13:49:20 schweikh Exp $
+# $DragonFly: src/etc/rc.d/DAEMON,v 1.1 2003/07/24 06:35:37 dillon Exp $
+#
+
+# PROVIDE: DAEMON
+# REQUIRE: NETWORKING SERVERS
+# KEYWORD: DragonFly FreeBSD NetBSD
+
+#      This is a dummy dependency, to ensure that general purpose daemons
+#      are run _after_ the above are.
diff --git a/etc/rc.d/LOGIN b/etc/rc.d/LOGIN
new file mode 100644 (file)
index 0000000..857a93d
--- /dev/null
@@ -0,0 +1,16 @@
+#!/bin/sh
+#
+# $NetBSD: LOGIN,v 1.7 2002/03/22 04:33:57 thorpej Exp $
+# $FreeBSD: src/etc/rc.d/LOGIN,v 1.3 2002/10/12 13:49:20 schweikh Exp $
+# $DragonFly: src/etc/rc.d/LOGIN,v 1.1 2003/07/24 06:35:37 dillon Exp $
+#
+
+# PROVIDE: LOGIN
+# REQUIRE: DAEMON
+# KEYWORD: DragonFly FreeBSD NetBSD
+
+#      This is a dummy dependency to ensure user services such as xdm,
+#      inetd, cron and kerberos are started after everything else, in case
+#      the administrator has increased the system security level and
+#      wants to delay user logins until the system is (almost) fully
+#      operational.
diff --git a/etc/rc.d/Makefile b/etc/rc.d/Makefile
new file mode 100644 (file)
index 0000000..08fad07
--- /dev/null
@@ -0,0 +1,30 @@
+# $NetBSD: Makefile,v 1.16 2001/01/14 15:37:22 minoura Exp $
+# $FreeBSD: src/etc/rc.d/Makefile,v 1.20 2003/06/29 05:15:57 mtm Exp $
+# $DragonFly: src/etc/rc.d/Makefile,v 1.1 2003/07/24 06:35:37 dillon Exp $
+
+.include <bsd.own.mk>
+
+# note: bgfsk, devd, devfs, and lomac left out (from 5.0)
+#
+FILES= DAEMON LOGIN NETWORKING SERVERS abi accounting addswap adjkerntz amd \
+       apm apmd archdep atm1 atm2.sh atm3.sh bootparams ccd cleanvar \
+       cleartmp cron dhclient diskless dmesg dumpon fsck \
+       hostname inetd initdiskless initrandom ip6fw ipfilter ipfs ipfw ipmon \
+       ipnat ipsec ipxrouted isdnd jail \
+       kadmind kerberos keyserv kldxref kpasswdd \
+       ldconfig local localdaemons lpd \
+       motd mountcritlocal mountcritremote \
+       mountd moused mroute6d mrouted msgs \
+       named netif netoptions network1 network2 network3 \
+       network_ipv6 nfsclient nfsd nfslocking nfsserver nisdomain ntpd \
+       ntpdate othermta pccard pcvt ppp-user pppoed pwcheck quota random \
+       rarpd rcconf.sh root route6d routed routing rpcbind rtadvd rwho \
+       savecore securelevel sendmail serial sppp sshd swap1 syscons sysctl \
+       syslogd timed ttys usbd vinum virecover watchdogd ypbind \
+       yppasswdd ypserv ypset ypupdated ypxfrd
+FILESDIR=      /etc/rc.d
+FILESMODE=     ${BINMODE}
+
+NOPROG= noprog
+
+.include <bsd.prog.mk>
diff --git a/etc/rc.d/NETWORKING b/etc/rc.d/NETWORKING
new file mode 100644 (file)
index 0000000..147cee9
--- /dev/null
@@ -0,0 +1,14 @@
+#!/bin/sh
+#
+# $NetBSD: NETWORKING,v 1.2 2002/03/22 04:33:57 thorpej Exp $
+# $FreeBSD: src/etc/rc.d/NETWORKING,v 1.6 2003/06/29 05:15:57 mtm Exp $
+# $DragonFly: src/etc/rc.d/NETWORKING,v 1.1 2003/07/24 06:35:37 dillon Exp $
+#
+
+# PROVIDE: NETWORKING NETWORK
+# REQUIRE: network dhclient altqd netif routing network_ipv6 isdnd ppp-user
+# REQUIRE: routed mrouted route6d mroute6d
+# KEYWORD: DragonFly FreeBSD NetBSD
+
+#      This is a dummy dependency, for services which require networking
+#      to be operational before starting.
diff --git a/etc/rc.d/SERVERS b/etc/rc.d/SERVERS
new file mode 100644 (file)
index 0000000..e7f4c08
--- /dev/null
@@ -0,0 +1,13 @@
+#!/bin/sh
+#
+# $NetBSD: SERVERS,v 1.9 2002/03/22 04:33:57 thorpej Exp $
+# $FreeBSD: src/etc/rc.d/SERVERS,v 1.3 2002/10/12 13:49:21 schweikh Exp $
+# $DragonFly: src/etc/rc.d/SERVERS,v 1.1 2003/07/24 06:35:37 dillon Exp $
+#
+
+# PROVIDE: SERVERS
+# REQUIRE: mountcritremote
+# KEYWORD: DragonFly FreeBSD NetBSD
+
+#      This is a dummy dependency, for early-start servers relying on
+#      some basic configuration.
diff --git a/etc/rc.d/abi b/etc/rc.d/abi
new file mode 100644 (file)
index 0000000..ab79e63
--- /dev/null
@@ -0,0 +1,56 @@
+#!/bin/sh
+#
+# $FreeBSD: src/etc/rc.d/abi,v 1.2 2003/05/05 15:38:41 mtm Exp $
+# $DragonFly: src/etc/rc.d/abi,v 1.1 2003/07/24 06:35:37 dillon Exp $
+#
+
+# PROVIDE: abi
+# REQUIRE: LOGIN
+# BEFORE:  securelevel
+# KEYWORD: DragonFly FreeBSD 
+
+. /etc/rc.subr
+
+echo -n 'Additional ABI support:'
+
+name="sysvipc"
+rcvar=`set_rcvar`
+start_cmd="sysv_start"
+stop_cmd=":"
+
+sysv_start()
+{
+       echo -n ' sysvipc'
+       kldload sysvmsg >/dev/null 2>&1
+       kldload sysvsem >/dev/null 2>&1
+       kldload sysvshm >/dev/null 2>&1
+}
+load_rc_config $name
+run_rc_command "$1"
+
+name="linux"
+rcvar=`set_rcvar`
+start_cmd="linux_start"
+
+linux_start()
+{
+       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
+}
+load_rc_config $name
+run_rc_command "$1"
+
+name="svr4"
+rcvar=`set_rcvar`
+start_precmd="echo -n ' svr4'"
+start_cmd="kldload svr4 > /dev/null 2>&1"
+
+load_rc_config $name
+run_rc_command "$1"
+
+echo '.'
diff --git a/etc/rc.d/accounting b/etc/rc.d/accounting
new file mode 100644 (file)
index 0000000..1e1fff8
--- /dev/null
@@ -0,0 +1,70 @@
+#!/bin/sh
+#
+# $NetBSD: accounting,v 1.7 2002/03/22 04:33:57 thorpej Exp $
+# $FreeBSD: src/etc/rc.d/accounting,v 1.4 2002/10/12 10:31:31 schweikh Exp $
+# $DragonFly: src/etc/rc.d/accounting,v 1.1 2003/07/24 06:35:37 dillon Exp $
+#
+
+# PROVIDE: accounting
+# REQUIRE: mountall
+# BEFORE: DAEMON
+# KEYWORD: DragonFly FreeBSD NetBSD 
+
+. /etc/rc.subr
+
+name="accounting"
+rcvar=`set_rcvar`
+accounting_command="/usr/sbin/accton"
+accounting_file="/var/account/acct"
+start_cmd="accounting_start"
+stop_cmd="accounting_stop"
+
+accounting_start()
+{
+       case ${OSTYPE} in
+       DragonFly)
+               _dir=`dirname "$accounting_file"`
+                if [ ! -d `dirname "$_dir"` ]; then
+                        if ! mkdir -p "$_dir"; then
+                                warn "Could not create $_dir."
+                                return 1
+                        fi
+                fi
+                if [ ! -e "$accounting_file" ]; then
+                        touch "$accounting_file"
+                fi
+                ;;
+       FreeBSD) 
+               _dir=`dirname "$accounting_file"`
+               if [ ! -d `dirname "$_dir"` ]; then
+                       if ! mkdir -p "$_dir"; then
+                               warn "Could not create $_dir."
+                               return 1
+                       fi
+               fi
+               if [ ! -e "$accounting_file" ]; then
+                       touch "$accounting_file"
+               fi
+               ;;
+       
+
+       *)
+               ;;
+       esac
+
+       if [ ! -f ${accounting_file} ]; then
+               echo "Creating accounting file ${accounting_file}"
+               ( umask 022 ; > ${accounting_file} )
+       fi
+       echo "Turning on accounting."
+       ${accounting_command} ${accounting_file}
+}
+
+accounting_stop()
+{
+       echo "Turning off accounting."
+       ${accounting_command}
+}
+
+load_rc_config $name
+run_rc_command "$1"
diff --git a/etc/rc.d/addswap b/etc/rc.d/addswap
new file mode 100644 (file)
index 0000000..8ccccdc
--- /dev/null
@@ -0,0 +1,35 @@
+#!/bin/sh
+#
+# Add additional swap files
+#
+# $FreeBSD: src/etc/rc.d/addswap,v 1.2 2002/10/12 10:31:31 schweikh Exp $
+# $DragonFly: src/etc/rc.d/addswap,v 1.1 2003/07/24 06:35:37 dillon Exp $
+#
+
+# PROVIDE: addswap
+# REQUIRE: mountcritlocal
+# BEFORE: sysctl
+# KEYWORD: DragonFly FreeBSD 
+
+. /etc/rc.subr
+
+name="addswap"
+start_cmd="addswap_start"
+stop_cmd=":"
+
+addswap_start()
+{
+       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
+}
+
+load_rc_config $name
+run_rc_command "$1"
diff --git a/etc/rc.d/adjkerntz b/etc/rc.d/adjkerntz
new file mode 100644 (file)
index 0000000..3ce9534
--- /dev/null
@@ -0,0 +1,19 @@
+#!/bin/sh
+#
+# $FreeBSD: src/etc/rc.d/adjkerntz,v 1.2 2003/04/18 17:55:05 mtm Exp $
+# $DragonFly: src/etc/rc.d/adjkerntz,v 1.1 2003/07/24 06:35:37 dillon Exp $
+#
+
+# PROVIDE: adjkerntz
+# REQUIRE: diskless mountcritlocal random
+# BEFORE: netif
+# KEYWORD: DragonFly FreeBSD 
+
+. /etc/rc.subr
+
+name="adjkerntz"
+start_cmd="adjkerntz -i"
+stop_cmd=":"
+
+load_rc_config $name
+run_rc_command "$1"
diff --git a/etc/rc.d/altqd b/etc/rc.d/altqd
new file mode 100644 (file)
index 0000000..b89d076
--- /dev/null
@@ -0,0 +1,23 @@
+#!/bin/sh
+#
+# $NetBSD: altqd,v 1.2 2002/03/22 04:33:58 thorpej Exp $
+# $FreeBSD: src/etc/rc.d/altqd,v 1.1 2002/06/13 22:14:36 gordon Exp $
+# $DragonFly: src/etc/rc.d/Attic/altqd,v 1.1 2003/07/24 06:35:37 dillon Exp $
+#
+
+# PROVIDE: altqd
+# REQUIRE: network mountcritlocal dhclient
+# BEFORE:  NETWORKING
+# KEYWORD: shutdown
+
+. /etc/rc.subr
+
+name="altqd"
+rcvar=$name
+command="/usr/sbin/${name}"
+pidfile="/var/run/${name}.pid"
+required_files="/etc/altq.conf"
+extra_commands="reload"
+
+load_rc_config $name
+run_rc_command "$1"
diff --git a/etc/rc.d/amd b/etc/rc.d/amd
new file mode 100644 (file)
index 0000000..70602e5
--- /dev/null
@@ -0,0 +1,101 @@
+#!/bin/sh
+#
+# $NetBSD: amd,v 1.10 2002/04/29 12:08:17 lukem Exp $
+# $FreeBSD: src/etc/rc.d/amd,v 1.9 2002/10/12 10:31:31 schweikh Exp $
+# $DragonFly: src/etc/rc.d/amd,v 1.1 2003/07/24 06:35:37 dillon Exp $
+#
+
+# PROVIDE: amd
+# REQUIRE: rpcbind mountall ypbind nfsclient
+# BEFORE: DAEMON
+# KEYWORD: DragonFly FreeBSD NetBSD 
+
+. /etc/rc.subr
+
+name="amd"
+rcvar=`set_rcvar`
+command="/usr/sbin/${name}"
+
+case ${OSTYPE} in
+DragonFly)
+       start_precmd="amd_precmd"
+        command_args="&"
+        ;;
+FreeBSD)
+       start_precmd="amd_precmd"
+       command_args="&"
+       ;;
+NetBSD)
+       command_args='-p -a '$amd_dir' -F /etc/amd.conf >/var/run/amd.pid'
+       required_dirs="$amd_dir"
+       required_files="/etc/amd.conf"
+       required_vars="rpcbind"
+       ;;
+esac
+
+amd_precmd()
+{
+       case ${OSTYPE} in
+       DragonFly)
+               if ! checkyesno nfs_client_enable; then
+                        force_depend nfsclient || return 1
+                fi
+
+                if ! checkyesno rpcbind_enable  && \
+                    ! /etc/rc.d/rpcbind forcestatus 1>/dev/null 2>&1
+                then
+                        force_depend rpcbind || return 1
+                fi
+
+                case ${amd_map_program} in
+                [Nn][Oo] | '')
+                        ;;
+                *)
+                        rc_flags="${rc_flags} `eval ${amd_map_program}`"
+                        ;;
+                esac
+
+                case "${amd_flags}" in
+                '')
+                        if [ ! -r /etc/amd.conf ]; then
+                                warn 'amd will not load without arguments'
+                                return 1
+                        fi
+                        ;;
+                esac
+                ;;
+
+       FreeBSD)
+               if ! checkyesno nfs_client_enable; then
+                       force_depend nfsclient || return 1
+               fi
+
+               if ! checkyesno rpcbind_enable  && \
+                   ! /etc/rc.d/rpcbind forcestatus 1>/dev/null 2>&1
+               then
+                       force_depend rpcbind || return 1
+               fi
+
+               case ${amd_map_program} in
+               [Nn][Oo] | '')
+                       ;;
+               *)
+                       rc_flags="${rc_flags} `eval ${amd_map_program}`"
+                       ;;
+               esac
+
+               case "${amd_flags}" in
+               '')
+                       if [ ! -r /etc/amd.conf ]; then
+                               warn 'amd will not load without arguments'
+                               return 1
+                       fi
+                       ;;
+               esac
+               ;;
+       esac
+       return 0
+}
+
+load_rc_config $name
+run_rc_command "$1"
diff --git a/etc/rc.d/apm b/etc/rc.d/apm
new file mode 100644 (file)
index 0000000..83eaea2
--- /dev/null
@@ -0,0 +1,47 @@
+#!/bin/sh
+#
+# $FreeBSD: src/etc/rc.d/apm,v 1.4 2003/06/09 17:44:30 mtm Exp $
+# $DragonFly: src/etc/rc.d/apm,v 1.1 2003/07/24 06:35:37 dillon Exp $
+#
+
+# PROVIDE: apm
+# REQUIRE: DAEMON
+# BEFORE:  LOGIN
+# KEYWORD: DragonFly  FreeBSD
+
+. /etc/rc.subr
+
+name="apm"
+rcvar=`set_rcvar`
+start_precmd="apm_precmd"
+command="/usr/sbin/${name}"
+start_cmd="${command} -e enable"
+stop_cmd="${command} -e disable"
+status_cmd="apm_status"
+
+apm_precmd()
+{
+       case `${SYSCTL_N} hw.machine_arch` in
+       i386)
+               return 0
+               ;;
+       esac
+       return 1
+}
+
+apm_status()
+{
+       case `${command} -s` in
+       1)
+               echo "APM is enabled."
+               return 0
+               ;;
+       0)
+               echo "APM is disabled"
+               ;;
+       esac
+       return 1
+}
+
+load_rc_config $name
+run_rc_command "$1"
diff --git a/etc/rc.d/apmd b/etc/rc.d/apmd
new file mode 100644 (file)
index 0000000..c63a575
--- /dev/null
@@ -0,0 +1,53 @@
+#!/bin/sh
+#
+# $NetBSD: apmd,v 1.5 2002/03/22 04:33:58 thorpej Exp $
+# $FreeBSD: src/etc/rc.d/apmd,v 1.8 2003/06/09 17:44:30 mtm Exp $
+# $DragonFly: src/etc/rc.d/apmd,v 1.1 2003/07/24 06:35:37 dillon Exp $
+#
+
+# PROVIDE: apmd
+# REQUIRE: DAEMON apm
+# BEFORE:  LOGIN
+# KEYWORD: DragonFly FreeBSD NetBSD 
+
+. /etc/rc.subr
+
+name="apmd"
+rcvar=`set_rcvar`
+command="/usr/sbin/${name}"
+
+case ${OSTYPE} in
+DragonFly)
+       start_precmd="apmd_prestart"
+       ;;
+FreeBSD)
+       start_precmd="apmd_prestart"
+       ;;
+esac
+
+apmd_prestart()
+{
+       case `${SYSCTL_N} hw.machine_arch` in
+       i386)
+               # Enable apm if it is not already enabled
+               if ! checkyesno apm_enable  && \
+                   ! /etc/rc.d/apm forcestatus 1>/dev/null 2>&1
+               then
+                       force_depend apm || return 1
+               fi
+
+               # Warn user about acpi apm compatibility support which
+               # does not work with apmd.
+               if [ ! -e /dev/apmctl ]; then
+                   warn "/dev/apmctl not found; kernel is missing apm(4)"
+               fi
+               ;;
+       *)
+               return 1
+               ;;
+       esac
+       return 0
+}
+
+load_rc_config $name
+run_rc_command "$1"
diff --git a/etc/rc.d/archdep b/etc/rc.d/archdep
new file mode 100644 (file)
index 0000000..d40a597
--- /dev/null
@@ -0,0 +1,71 @@
+#!/bin/sh
+#
+# $FreeBSD: src/etc/rc.d/archdep,v 1.5 2003/05/06 00:09:51 obrien Exp $
+# $DragonFly: src/etc/rc.d/Attic/archdep,v 1.1 2003/07/24 06:35:37 dillon Exp $
+#
+
+# PROVIDE: archdep
+# REQUIRE: LOGIN
+# BEFORE: abi
+# KEYWORD: DragonFly FreeBSD 
+
+. /etc/rc.subr
+
+name=archdep
+load_rc_config $name
+
+# should we print out unaligned access warnings?
+#
+unaligned_warnings()
+{
+       if ! checkyesno unaligned_print; then
+               sysctl machdep.unaligned_print=0
+       fi
+}
+
+# Alpha OSF/1 binary emulation
+#
+osf1_compat()
+{
+       if checkyesno osf1_enable; then
+               echo -n ' OSF/1'
+               if ! kldstat -v | grep osf1_ecoff > /dev/null; then
+                       kldload osf1 > /dev/null 2>&1
+               fi
+       fi
+}
+
+# SCO binary emulation
+#
+ibcs2_compat()
+{
+       if checkyesno ibcs2_enable; then
+               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
+       fi
+}
+
+_arch=`${SYSCTL_N} hw.machine`
+echo -n "Initial $_arch initialization:"
+case $_arch in
+i386)
+       ibcs2_compat
+       ;;
+alpha)
+       osf1_compat
+       unaligned_warnings
+       ;;
+ia64)
+       unaligned_warnings
+       ;;
+esac
+echo '.'
similarity index 65%
rename from etc/rc.atm
rename to etc/rc.d/atm1
index e95b684..ed4bcb7 100644 (file)
 # OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
 # SUCH DAMAGE.
 #
-# $FreeBSD: src/etc/rc.atm,v 1.6.2.3 2001/11/19 10:42:28 sheldonh Exp $
-# $DragonFly: src/etc/Attic/rc.atm,v 1.2 2003/06/17 04:24:45 dillon Exp $
+# $FreeBSD: src/etc/rc.d/atm1,v 1.12 2003/04/18 17:55:05 mtm Exp $
+# $DragonFly: src/etc/rc.d/atm1,v 1.1 2003/07/24 06:35:37 dillon Exp $
 #
 
-#
+# PROVIDE: atm1
+# REQUIRE: root
+# BEFORE: netif
+# KEYWORD: DragonFly FreeBSD
+
+. /etc/rc.subr
+
+name="atm"
+rcvar="atm_enable"
+start_cmd="atm_start"
+stop_cmd=":"
+
 # ATM networking startup script
 #
 # Initial interface configuration.
 # N.B. /usr is not mounted.
 #
-atm_pass1() {
+atm_start()
+{
        # Locate all probed ATM adapters
        atmdev=`atm sh stat int | while read dev junk; do
                case ${dev} in
@@ -44,6 +56,9 @@ atm_pass1() {
                hfa[0-9] | hfa[0-9][0-9])
                        echo "${dev} "
                        ;;
+               idt[0-9] | idt[0-9][0-9])
+                       echo "${dev} "
+                       ;;
                *)
                        continue
                        ;;
@@ -127,92 +142,7 @@ atm_pass1() {
        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
-}
+load_rc_config $name
+run_rc_command "$1"
diff --git a/etc/rc.d/atm2.sh b/etc/rc.d/atm2.sh
new file mode 100644 (file)
index 0000000..8d2cb1c
--- /dev/null
@@ -0,0 +1,105 @@
+#!/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: src/etc/rc.d/atm2.sh,v 1.13 2003/06/29 05:15:57 mtm Exp $
+# $DragonFly: src/etc/rc.d/atm2.sh,v 1.1 2003/07/24 06:35:37 dillon Exp $
+#
+
+# PROVIDE: atm2
+# REQUIRE: atm1 netif
+# BEFORE:  routing
+# KEYWORD: DragonFly FreeBSD 
+
+#
+# Additional ATM interface configuration
+#
+
+. /etc/rc.subr
+
+atm2_start()
+{
+       # 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 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
+
+       # XXX - required by atm3.sh. I don't like having one script depend
+       #       on variables in another script (especially in a dynamic
+       #       ordered system like this), but it's necessary for the moment.
+       #
+       export atm_atmarpd
+       export atm_scspd
+}
+
+load_rc_config "XXX"
+
+case ${atm_enable} in
+[Yy][Ee][Ss])
+       atm2_start
+       ;;
+esac
similarity index 64%
rename from etc/rc.pccard
rename to etc/rc.d/atm3.sh
index 974a25f..ac45881 100644 (file)
@@ -1,6 +1,6 @@
-#!/bin/sh -
+#!/bin/sh
 #
-# Copyright (c) 1996  The FreeBSD Project
+# Copyright (c) 2000  The FreeBSD Project
 # All rights reserved.
 #
 # Redistribution and use in source and binary forms, with or without
 # OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
 # SUCH DAMAGE.
 #
-# $FreeBSD: src/etc/rc.pccard,v 1.20.2.5 2001/03/06 02:22:00 obrien Exp $
-# $DragonFly: src/etc/Attic/rc.pccard,v 1.2 2003/06/17 04:24:45 dillon Exp $
+# $FreeBSD: src/etc/rc.d/atm3.sh,v 1.10 2002/06/13 22:14:36 gordon Exp $
+# $DragonFly: src/etc/rc.d/atm3.sh,v 1.1 2003/07/24 06:35:37 dillon Exp $
 #
 
-#      PC-card startup script
+# Start ATM daemons
+# XXX - This script uses global variables set by scripts atm1 and atm2.
+#      Ideally this shouldn't be the case.
+#
 
-case ${pccard_enable} in
-[Yy][Ee][Ss])
-       echo -n 'Setup PC-CARD:'
+# PROVIDE: atm3
+# REQUIRE: atm2
+# BEFORE: DAEMON
+# KEYWORD: DragonFly FreeBSD 
 
-       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'
+. /etc/rc.subr
+
+atm3_start()
+{
+       echo -n 'Starting ATM daemons:'
+
+       # Start SCSP daemon (if needed)
+       case ${atm_scspd} in
+       1)
+               echo -n ' scspd'
+               scspd
                ;;
        esac
 
-       if [ -n "${pccard_beep}" ] ; then
-               pccardc beep ${pccard_beep} && echo -n ' beep'
+       # Start ATMARP daemon (if needed)
+       if [ -n "${atm_atmarpd}" ]; then
+               echo -n ' atmarpd'
+               atmarpd ${atm_atmarpd}
        fi
+       echo '.'
+}
 
-       if [ -n "${pccard_conf}" ]; then
-               pccardd_flags="${pccardd_flags} -f ${pccard_conf}"
-       fi
+load_rc_config "XXX"
 
-       pccardd ${pccardd_flags} && echo -n ' pccardd'
-       echo '.'
+case ${atm_enable} in
+[Yy][Ee][Ss])
+       atm3_start
        ;;
 esac
diff --git a/etc/rc.d/bootconf.sh b/etc/rc.d/bootconf.sh
new file mode 100644 (file)
index 0000000..592e4a7
--- /dev/null
@@ -0,0 +1,83 @@
+#!/bin/sh
+#
+# $NetBSD: bootconf.sh,v 1.5 2002/03/25 03:22:10 wiz Exp $
+# $FreeBSD: src/etc/rc.d/bootconf.sh,v 1.4 2002/10/12 10:31:31 schweikh Exp $
+# $DragonFly: src/etc/rc.d/Attic/bootconf.sh,v 1.1 2003/07/24 06:35:37 dillon Exp $
+#
+
+# PROVIDE: bootconf
+# REQUIRE: mountcritlocal
+
+bootconf_start()
+{
+               # Refer to newbtconf(8) for more information
+               #
+
+       if [ ! -e /etc/etc.current ]; then
+               return 0
+       fi
+       if [ -L /etc/etc.default ]; then
+               def=`ls -ld /etc/etc.default 2>&1`
+               default="${def##*-> etc.}"
+       else
+               default=current
+       fi
+       if [ "$default" = "current" ]; then
+               def=`ls -ld /etc/etc.current 2>&1`
+               default="${def##*-> etc.}"
+       fi
+
+       spc=""
+       for i in /etc/etc.*; do
+               name="${i##/etc/etc.}"
+               case $name in
+               current|default|\*)
+                       continue
+                       ;;
+               *)
+                       if [ "$name" = "$default" ]; then
+                               echo -n "${spc}[${name}]"
+                       else
+                               echo -n "${spc}${name}"
+                       fi
+                       spc=" "
+                       ;;
+               esac
+       done
+       echo
+       master=$$
+       _DUMMY=/etc/passwd
+       conf=${_DUMMY}
+       while [ ! -d /etc/etc.$conf/. ]; do
+               trap "conf=$default; echo; echo Using default of $conf" ALRM
+               echo -n "Which configuration [$default] ? "
+               (sleep 30 && kill -ALRM $master) >/dev/null 2>&1 &
+               read conf
+               trap : ALRM
+               if [ -z $conf ]; then
+                       conf=$default
+               fi
+               if [ ! -d /etc/etc.$conf/. ]; then
+                       conf=${_DUMMY}
+               fi
+       done
+
+       case  $conf in
+       current|default)
+               ;;
+       *)
+               rm -f /etc/etc.current
+               ln -s /etc/etc.$conf /etc/etc.current
+               ;;
+       esac
+
+       if [ -f /etc/rc.conf ]; then
+               . /etc/rc.conf
+       fi
+}
+
+case "$1" in
+*start)
+       bootconf_start
+       ;;
+esac
diff --git a/etc/rc.d/bootparams b/etc/rc.d/bootparams
new file mode 100644 (file)
index 0000000..0c8f9f6
--- /dev/null
@@ -0,0 +1,32 @@
+#!/bin/sh
+#
+# $NetBSD: bootparams,v 1.6 2002/03/22 04:33:58 thorpej Exp $
+# $FreeBSD: src/etc/rc.d/bootparams,v 1.4 2002/09/06 16:18:05 gordon Exp $
+# $DragonFly: src/etc/rc.d/bootparams,v 1.1 2003/07/24 06:35:37 dillon Exp $
+#
+
+# PROVIDE: bootparams
+# REQUIRE: rpcbind DAEMON
+# BEFORE:  LOGIN
+# KEYWORD: DragonFly FreeBSD
+
+. /etc/rc.subr
+
+name="bootparamd"
+rcvar=`set_rcvar`
+required_files="/etc/bootparams"
+
+case ${OSTYPE} in
+DragonFly)
+       command="/usr/sbin/${name}"
+       ;;
+FreeBSD)
+       command="/usr/sbin/${name}"
+       ;;
+NetBSD)
+       command="/usr/sbin/rpc.${name}"
+       ;;
+esac
+
+load_rc_config $name
+run_rc_command "$1"
diff --git a/etc/rc.d/ccd b/etc/rc.d/ccd
new file mode 100644 (file)
index 0000000..2b2b0a6
--- /dev/null
@@ -0,0 +1,26 @@
+#!/bin/sh
+#
+# $NetBSD: ccd,v 1.3 2000/05/13 08:45:06 lukem Exp $
+# $FreeBSD: src/etc/rc.d/ccd,v 1.2 2002/06/13 22:14:36 gordon Exp $
+# $DragonFly: src/etc/rc.d/ccd,v 1.1 2003/07/24 06:35:37 dillon Exp $
+#
+
+# PROVIDE: disks
+# KEYWORD: DragonFly FreeBSD NetBSD
+
+. /etc/rc.subr
+
+name="ccd"
+start_cmd="ccd_start"
+stop_cmd=":"
+
+ccd_start()
+{
+       if [ -f /etc/ccd.conf ]; then
+               echo "Configuring CCD devices."
+               ccdconfig -C
+       fi
+}
+
+load_rc_config $name
+run_rc_command "$1"
diff --git a/etc/rc.d/cleanvar b/etc/rc.d/cleanvar
new file mode 100644 (file)
index 0000000..ca3b7af
--- /dev/null
@@ -0,0 +1,52 @@
+#!/bin/sh
+#
+# $FreeBSD: src/etc/rc.d/cleanvar,v 1.5 2003/07/14 13:02:36 mtm Exp $
+# $DragonFly: src/etc/rc.d/cleanvar,v 1.1 2003/07/24 06:35:37 dillon Exp $
+#
+
+# PROVIDE: cleanvar
+# REQUIRE: mountcritlocal
+# KEYWORD: DragonFly FreeBSD
+
+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
+}
+
+# These files must be removed only the first time this script is run
+# on boot.
+#
+[ "$1" != "reload" ] && rm -f /var/run/clean_var /var/spool/lock/clean_var
+
+if [ -d /var/run -a ! -f /var/run/clean_var ]; then
+       purgedir /var/run
+       # 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/*
+
diff --git a/etc/rc.d/cleartmp b/etc/rc.d/cleartmp
new file mode 100644 (file)
index 0000000..23a71d0
--- /dev/null
@@ -0,0 +1,56 @@
+#!/bin/sh
+#
+# $NetBSD: cleartmp,v 1.4 2002/03/22 04:33:58 thorpej Exp $
+# $FreeBSD: src/etc/rc.d/cleartmp,v 1.4 2002/10/12 10:31:31 schweikh Exp $
+# $DragonFly: src/etc/rc.d/cleartmp,v 1.1 2003/07/24 06:35:37 dillon Exp $
+#
+
+# PROVIDE: cleartmp
+# REQUIRE: mountall
+# BEFORE: DAEMON
+# KEYWORD: DragonFly FreeBSD NetBSD
+
+. /etc/rc.subr
+
+name="cleartmp"
+rcvar=`set_rcvar clear_tmp`
+start_cmd="cleartmp_start"
+stop_cmd=":"
+
+cleartmp_start()
+{
+       echo "Clearing /tmp."
+       #
+       #       Prune quickly with one rm, then use find to clean up
+       #       /tmp/[lq]* (this is not needed with mfs /tmp, but
+       #       doesn't hurt anything).
+       #
+       (cd /tmp && rm -rf [a-km-pr-zA-Z]* &&
+           find -x . ! -name . ! -name lost+found ! -name quota.user \
+               ! -name quota.group -exec rm -rf -- {} \; -type d -prune)
+
+       case ${OSTYPE} in
+       DragonFly)
+               # Remove X lock files, since they will prevent you from
+                # restarting X
+                #
+                rm -f /tmp/.X*-lock
+                rm -fr /tmp/.X11-unix
+                mkdir -m 1777 /tmp/.X11-unix
+                ;;
+
+       FreeBSD)
+               # Remove X lock files, since they will prevent you from
+               # restarting X
+               #
+               rm -f /tmp/.X*-lock
+               rm -fr /tmp/.X11-unix
+               mkdir -m 1777 /tmp/.X11-unix
+               ;;
+       NetBSD)
+               ;;
+       esac
+}
+
+load_rc_config $name
+run_rc_command "$1"
diff --git a/etc/rc.d/cron b/etc/rc.d/cron
new file mode 100644 (file)
index 0000000..61eed3d
--- /dev/null
@@ -0,0 +1,21 @@
+#!/bin/sh
+#
+# $NetBSD: cron,v 1.5 2000/09/19 13:04:38 lukem Exp $
+# $FreeBSD: src/etc/rc.d/cron,v 1.3 2003/05/05 15:38:41 mtm Exp $
+# $DragonFly: src/etc/rc.d/cron,v 1.1 2003/07/24 06:35:37 dillon Exp $
+#
+
+# PROVIDE: cron
+# REQUIRE: LOGIN
+# BEFORE: securelevel
+# KEYWORD: DragonFly FreeBSD NetBSD shutdown
+
+. /etc/rc.subr
+
+name="cron"
+rcvar="`set_rcvar`"
+command="/usr/sbin/${name}"
+pidfile="/var/run/${name}.pid"
+
+load_rc_config $name
+run_rc_command "$1"
diff --git a/etc/rc.d/dhclient b/etc/rc.d/dhclient
new file mode 100644 (file)
index 0000000..030773c
--- /dev/null
@@ -0,0 +1,124 @@
+#!/bin/sh
+#
+# $NetBSD: dhclient,v 1.8 2002/03/22 04:33:58 thorpej Exp $
+# $FreeBSD: src/etc/rc.d/dhclient,v 1.6 2003/06/29 05:34:41 mtm Exp $
+# $DragonFly: src/etc/rc.d/dhclient,v 1.1 2003/07/24 06:35:37 dillon Exp $
+#
+
+# PROVIDE: dhclient
+# REQUIRE: network netif mountcritlocal
+# BEFORE:  NETWORKING
+# KEYWORD: DragonFly FreeBSD NetBSD
+#
+#      Note that there no syslog logging of dhclient messages at boot because
+#      dhclient needs to start before services that syslog depends upon do.
+#
+
+. /etc/rc.subr
+. /etc/network.subr
+
+name="dhclient"
+pidfile="/var/run/${name}.pid"
+case "${OSTYPE}" in
+DragonFly)
+        rcvar=
+        start_precmd="dhclient_prestart"
+        start_postcmd="dhclient_poststart"
+        stop_cmd="dhclient_stop"
+        stop_precmd="dhclient_prestop"
+        stop_postcmd="dhclient_poststop"
+        ;;
+
+FreeBSD)
+       rcvar=
+       start_precmd="dhclient_prestart"
+       start_postcmd="dhclient_poststart"
+       stop_cmd="dhclient_stop"
+       stop_precmd="dhclient_prestop"
+       stop_postcmd="dhclient_poststop"
+       ;;
+NetBSD)
+       rcvar=$name
+       command="/sbin/${name}"
+       ;;
+esac
+
+dhclient_common()
+{
+       dhcp_list="`list_net_interfaces dhcp`"
+       if [ -z "$dhcp_list" ]; then
+               return 1
+       fi
+
+       # Determine the scope of the command
+       #
+       _cooked_list="$dhcp_list"
+       if [ -n "$_cmdifn" ]; then
+               eval _cooked_list=\"`expr "$dhcp_list" : ".*\($_cmdifn\).*"`\"
+               if [ -z "$_cooked_list" ]; then
+                       err "No such network interface: $_cmdifn"
+                       return 1
+               fi
+       fi
+}
+
+dhclient_prestart()
+{
+       dhclient_common || return 1
+
+       for ifn in ${_cooked_list}; do
+               ifscript_up ${ifn}
+       done
+
+       rc_flags="${rc_flags} ${_cooked_list}"
+       return 0
+}
+
+dhclient_poststart()
+{
+       for ifn in ${_cooked_list}; do
+               ifalias_up ${ifn}
+               ipx_up ${ifn}
+               ifconfig ${ifn}
+       done
+}
+
+dhclient_stop()
+{
+       echo -n "Releasing DHCP leases:"
+       for ifn in $_cooked_list ; do
+               ${command} -r $ifn
+               if [ $? -eq 0 ]; then
+                       echo -n " $ifn"
+               else
+                       _fail="$_fail $ifn"
+               fi
+       done
+       echo '.'
+       debug "The following leases failed to release: $_fail"
+}
+
+dhclient_prestop()
+{
+       dhclient_common || return 1
+
+       for ifn in ${_cooked_list}; do
+               ipx_down ${ifn}
+               ifalias_down ${ifn}
+       done
+}
+
+dhclient_poststop()
+{
+       for ifn in ${_cooked_list}; do
+               ifscript_down ${ifn}
+       done
+}
+
+if [ -n "$2" ]; then
+       _cmdifn="$2"
+fi
+
+load_rc_config $name
+
+run_rc_command "$1"
diff --git a/etc/rc.d/dhcpd b/etc/rc.d/dhcpd
new file mode 100644 (file)
index 0000000..774be69
--- /dev/null
@@ -0,0 +1,21 @@
+#!/bin/sh
+#
+# $NetBSD: dhcpd,v 1.5 2002/03/22 04:33:58 thorpej Exp $
+# $FreeBSD: src/etc/rc.d/dhcpd,v 1.2 2002/06/13 22:14:36 gordon Exp $
+# $DragonFly: src/etc/rc.d/Attic/dhcpd,v 1.1 2003/07/24 06:35:37 dillon Exp $
+#
+
+# PROVIDE: dhcpd
+# REQUIRE: DAEMON
+# BEFORE:  LOGIN
+
+. /etc/rc.subr
+
+name="dhcpd"
+rcvar=$name
+command="/usr/sbin/${name}"
+pidfile="/var/run/${name}.pid"
+required_files="/etc/${name}.conf /var/db/${name}.leases"
+
+load_rc_config $name
+run_rc_command "$1"
diff --git a/etc/rc.d/dhcrelay b/etc/rc.d/dhcrelay
new file mode 100644 (file)
index 0000000..56b045c
--- /dev/null
@@ -0,0 +1,20 @@
+#!/bin/sh
+#
+# $NetBSD: dhcrelay,v 1.5 2002/03/22 04:33:58 thorpej Exp $
+# $FreeBSD: src/etc/rc.d/dhcrelay,v 1.2 2002/06/13 22:14:36 gordon Exp $
+# $DragonFly: src/etc/rc.d/Attic/dhcrelay,v 1.1 2003/07/24 06:35:37 dillon Exp $
+#
+
+# PROVIDE: dhcrelay
+# REQUIRE: DAEMON
+# BEFORE:  LOGIN
+
+. /etc/rc.subr
+
+name="dhcrelay"
+rcvar=$name
+command="/usr/sbin/${name}"
+pidfile="/var/run/${name}.pid"
+
+load_rc_config $name
+run_rc_command "$1"
similarity index 68%
rename from etc/rc.diskless2
rename to etc/rc.d/diskless
index e6d30a5..df087e0 100644 (file)
@@ -1,3 +1,5 @@
+#!/bin/sh
+#
 # Copyright (c) 1999  Matt Dillon
 # All rights reserved.
 #
 # OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
 # SUCH DAMAGE.
 #
-# $FreeBSD: src/etc/rc.diskless2,v 1.5.2.14 2002/12/23 17:39:06 dillon Exp $
-# $DragonFly: src/etc/Attic/rc.diskless2,v 1.2 2003/06/17 04:24:45 dillon Exp $
+# $FreeBSD: src/etc/rc.d/diskless,v 1.25 2003/02/15 16:34:14 jhay Exp $
+# $DragonFly: src/etc/rc.d/diskless,v 1.1 2003/07/24 06:35:37 dillon Exp $
 #
 
-#
-# rc.diskless2
-#
+# PROVIDE: diskless
+# REQUIRE: initdiskless rcconf mountcritlocal
+# BEFORE: addswap random
+# KEYWORD: DragonFly FreeBSD
+
+dlv=`/sbin/sysctl -n vfs.nfs.diskless_valid 2> /dev/null`
+[ ${dlv:=0} -eq 0 ] && exit 0
+
+name="diskless2"
 
 # Provide a function for normalizing the mounting of memory
 # filesystems.  This should allow the rest of the code here to remain
@@ -40,12 +48,15 @@ mount_md() {
        if [ -n "$3" ]; then
                bpi="-i $3"
        fi
-       /sbin/mount_mfs -s $1 -T qp120at -b 8192 -f 1024 $bpi dummy $2
+       /sbin/mdmfs $bpi -s $1 -M md $2
 }
 
 # If there is a global system configuration file, suck it in.
 #
-if [ -r /etc/defaults/rc.conf ]; then
+if [ -r /etc/rc.subr ]; then
+       . /etc/rc.subr
+       load_rc_config $name
+elif [ -r /etc/defaults/rc.conf ]; then
        . /etc/defaults/rc.conf
        source_rc_confs
 elif [ -r /etc/rc.conf ]; then
@@ -59,25 +70,24 @@ fi
 # exists before doing the mount -a.
 #
 if (/bin/mkdir /var/.diskless 2> /dev/null); then
-       rmdir /var/.diskless
+        rmdir /var/.diskless
 else
-       echo "+++ mfs_mount of /var"
-       mount_md ${varsize:=65536} /var
+       echo "+++ mount_md of /var"
+       mount_md ${varsize:=32m} /var
 fi
 
 if [ ! -d /var/db ]; then
        mkdir /var/db
 fi
 
-# Now we need the rest of our mounts, particularly /usr.
+# Now we need the rest of our mounts, particularly /usr
 #
-mount -a
+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])
        ;;
@@ -100,7 +110,6 @@ echo "+++ create lastlog"
 #
 /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
@@ -120,19 +129,38 @@ else
        fi
 fi
 
-# If /dev has already been created in rc.diskless1 it will be writable
-# and we do nothing.  If /dev is not writable then we have to dup it as
-# a memory filesystem.
-#
-# note: /conf/dev.cpio.gz is no longer valid.  Use /conf/base/dev.cpio.gz
-# instead and it will be handled in rc.diskless1
-
-if (/bin/mkdir /dev/.diskless 2> /dev/null); then
+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 --create -H newc | gzip) > /tmp/dev.cpio.gz
+       (cd /; find -x dev | cpio -o -H newc) > /tmp/dev.tmp
        mount_md 4096 /dev 512
-       (cd /; gzip -dc /tmp/dev.cpio.gz | cpio --extract -H newc -d )
-       rm -f /tmp/dev.cpio.gz
+       (cd /; cpio -i -H newc -d < /tmp/dev.tmp)
+       rm -f /tmp/dev.tmp
+fi
+
+# generate our hostname
+#
+if [ -z "`hostname -s`" ]; then
+        hostname=`/bin/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 `/bin/kenv dhcp.domain-name` > /etc/resolv.conf
+
+        set `/bin/kenv dhcp.domain-name-servers`
+        for ns in `IFS=','; echo $*`; do
+                echo nameserver $ns >> /etc/resolv.conf;
+        done
 fi
 
diff --git a/etc/rc.d/dmesg b/etc/rc.d/dmesg
new file mode 100644 (file)
index 0000000..78f4853
--- /dev/null
@@ -0,0 +1,28 @@
+#!/bin/sh
+#
+# $NetBSD: dmesg,v 1.8 2002/03/22 04:33:58 thorpej Exp $
+# $FreeBSD: src/etc/rc.d/dmesg,v 1.2 2002/06/13 22:14:36 gordon Exp $
+# $DragonFly: src/etc/rc.d/dmesg,v 1.1 2003/07/24 06:35:37 dillon Exp $
+#
+
+# PROVIDE: dmesg
+# REQUIRE: mountcritremote
+# BEFORE:  DAEMON
+# KEYWORD: DragonFly FreeBSD Daemon
+
+. /etc/rc.subr
+
+name="dmesg"
+rcvar=`set_rcvar`
+dmesg_file="/var/run/dmesg.boot"
+start_cmd="do_dmesg"
+stop_cmd=":"
+
+do_dmesg()
+{
+       rm -f ${dmesg_file}
+       ( umask 022 ; /sbin/dmesg $rc_flags > ${dmesg_file} )
+}
+
+load_rc_config $name
+run_rc_command "$1"
diff --git a/etc/rc.d/downinterfaces b/etc/rc.d/downinterfaces
new file mode 100644 (file)
index 0000000..e0fae51
--- /dev/null
@@ -0,0 +1,28 @@
+#!/bin/sh
+#
+# $NetBSD: downinterfaces,v 1.2 2001/09/04 20:40:40 martin Exp $
+# $DragonFly: src/etc/rc.d/Attic/downinterfaces,v 1.1 2003/07/24 06:35:37 dillon Exp $
+#
+
+# PROVIDE: downinterfaces
+# KEYWORD: shutdown
+
+if [ "x$1" != "xstop" ]; then exit 0; fi
+
+. /etc/rc.conf
+
+tmp=`ifconfig -lu`
+iflist=""
+for int in $tmp; do
+       case $int in
+       pppoe*) iflist="$iflist $int"
+               ;;
+       esac
+done
+iflist="$iflist $force_down_interfaces"
+if [ "$iflist" = "" ] || [ "$iflist" = " " ]; then exit 0; fi
+
+echo "Shutting down interfaces:$iflist"
+for int in $iflist; do
+       ifconfig $int down
+done
diff --git a/etc/rc.d/dumpon b/etc/rc.d/dumpon
new file mode 100644 (file)
index 0000000..7c65a36
--- /dev/null
@@ -0,0 +1,33 @@
+#!/bin/sh
+#
+# $FreeBSD: src/etc/rc.d/dumpon,v 1.1 2002/06/13 22:14:36 gordon Exp $
+# $DragonFly: src/etc/rc.d/dumpon,v 1.1 2003/07/24 06:35:37 dillon Exp $
+#
+
+# PROVIDE: dumpon
+# REQUIRE: initrandom
+# BEFORE: disks savecore
+# KEYWORD: DragonFly FreeBSD
+
+. /etc/rc.subr
+
+name="dumpon"
+start_cmd="dumpon_start"
+stop_cmd=":"
+
+dumpon_start()
+{
+       # Enable dumpdev so that savecore can see it. Enable it
+       # early so a crash early in the boot process can be caught.
+       #
+       case ${dumpdev} in
+       [Nn][Oo] | '')
+               ;;
+       *)
+               /sbin/dumpon -v ${dumpdev}
+               ;;
+       esac
+}
+
+load_rc_config $name
+run_rc_command "$1"
diff --git a/etc/rc.d/early.sh b/etc/rc.d/early.sh
new file mode 100644 (file)
index 0000000..e342442
--- /dev/null
@@ -0,0 +1,17 @@
+#!/bin/sh
+#
+# $FreeBSD: src/etc/rc.d/early.sh,v 1.1 2003/04/24 08:27:29 mtm Exp $
+# $DragonFly: src/etc/rc.d/Attic/early.sh,v 1.1 2003/07/24 06:35:37 dillon Exp $
+#
+
+# PROVIDE: early
+# REQUIRE: disks localswap
+# BEFORE:  fsck
+# KEYWORD: DragonFly FreeBSD
+
+#
+# Support for legacy /etc/rc.early script
+#
+if [ -r /etc/rc.early ]; then
+       . /etc/rc.early
+fi
diff --git a/etc/rc.d/fsck b/etc/rc.d/fsck
new file mode 100644 (file)
index 0000000..4346dd5
--- /dev/null
@@ -0,0 +1,121 @@
+#!/bin/sh
+#
+# $NetBSD: fsck,v 1.2 2001/06/18 06:42:35 lukem Exp $
+# $FreeBSD: src/etc/rc.d/fsck,v 1.4 2002/10/12 10:31:31 schweikh Exp $
+# $DragonFly: src/etc/rc.d/fsck,v 1.1 2003/07/24 06:35:37 dillon Exp $
+#
+
+# PROVIDE: fsck
+# REQUIRE: localswap
+# KEYWORD: DragonFly FreeBSD NetBSD
+
+. /etc/rc.subr
+
+name="fsck"
+start_cmd="fsck_start"
+stop_cmd=":"
+
+stop_boot()
+{
+       #       Terminate the process (which may include the parent /etc/rc)
+       #       if booting directly to multiuser mode.
+       #
+       if [ "$autoboot" = yes ]; then
+               kill -TERM $$
+       fi
+       exit 1
+}
+
+fsck_start()
+{
+       if [ "$autoboot" = no ]; then
+               echo "Fast boot: skipping disk checks."
+       elif [ "$autoboot" = yes ]; then
+                                       # During fsck ignore SIGQUIT
+               trap : 3
+
+               echo "Starting file system checks:"
+               case ${OSTYPE} in
+               DragonFly)
+                       fsck -p
+                       ;;
+               FreeBSD)
+                       fsck -p
+                       ;;
+               NetBSD)
+                       fsck -p
+                       ;;
+               esac
+
+               case $? in
+               0)
+                       ;;
+               2)
+                       stop_boot
+                       ;;
+               4)
+                       echo "Rebooting..."
+                       reboot
+                       echo "Reboot failed; help!"
+                       stop_boot
+                       ;;
+               8)
+               case ${OSTYPE} in
+               DragonFly)
+                                if checkyesno fsck_y_enable; then
+                                echo "File system preen failed, trying fsck -y."
+                                fsck -y
+                                case $? in
+                                0)
+                                        ;;
+                                *)
+                                echo "Automatic file system check failed; help!"
+                                        stop_boot
+                                        ;;
+                                esac
+                        else
+                                echo "Automatic file system check failed; help!"
+                                stop_boot
+                        fi
+                        ;;
+
+               FreeBSD)
+                       if checkyesno fsck_y_enable; then
+                               echo "File system preen failed, trying fsck -y."
+                               fsck -y
+                               case $? in
+                               0)
+                                       ;;
+                               *)
+                               echo "Automatic file system check failed; help!"
+                                       stop_boot
+                                       ;;
+                               esac
+                       else
+                               echo "Automatic file system check failed; help!"
+                               stop_boot
+                       fi
+                       ;;
+               NetBSD)
+                       echo "Automatic file system check failed; help!"
+                       stop_boot
+                       ;;
+               esac
+               ;;
+               12)
+                       echo "Boot interrupted."
+                       stop_boot
+                       ;;
+               130)
+                       stop_boot
+                       ;;
+               *)
+                       echo "Unknown error; help!"
+                       stop_boot
+                       ;;
+               esac
+       fi
+}
+
+load_rc_config $name
+run_rc_command "$1"
diff --git a/etc/rc.d/gated b/etc/rc.d/gated
new file mode 100644 (file)
index 0000000..e0b974c
--- /dev/null
@@ -0,0 +1,19 @@
+#!/bin/sh
+#
+# $NetBSD: gated,v 1.3 2000/05/13 08:45:06 lukem Exp $
+# $DragonFly: src/etc/rc.d/Attic/gated,v 1.1 2003/07/24 06:35:37 dillon Exp $
+#
+
+# PROVIDE: gated
+# REQUIRE: DAEMON
+
+. /etc/rc.subr
+
+name="gated"
+rcvar=$name
+command="/usr/sbin/${name}"
+pidfile="/var/run/${name}.pid"
+required_files="/etc/${name}.conf"
+
+load_rc_config $name
+run_rc_command "$1"
similarity index 57%
copy from etc/rc.sysctl
copy to etc/rc.d/hostname
index 546658c..ae7b10f 100644 (file)
@@ -1,7 +1,6 @@
 #!/bin/sh
 #
-# Copyright (c) 1999  Warner Losh
-# All rights reserved.
+# Copyright (c) 2003 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
 #    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
+# THIS SOFTWARE IS PROVIDED BY THE PROJECT 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
+# ARE DISCLAIMED.  IN NO EVENT SHALL THE PROJECT 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)
 # OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
 # SUCH DAMAGE.
 #
-# $FreeBSD: src/etc/rc.sysctl,v 1.4.4.6 2002/04/15 00:44:13 dougb Exp $
-# $DragonFly: src/etc/Attic/rc.sysctl,v 1.2 2003/06/17 04:24:45 dillon Exp $
+# $FreeBSD: src/etc/rc.d/hostname,v 1.2 2003/04/24 08:20:47 mtm Exp $
+# $DragonFly: src/etc/rc.d/hostname,v 1.1 2003/07/24 06:35:37 dillon Exp $
 #
 
-#
-# Read in /etc/sysctl.conf and set things accordingly
-#
+# PROVIDE: hostname
+# REQUIRE: mountcritlocal tty
+# BEFORE:  netif
+# KEYWORD: DragonFly FreeBSD
+
+. /etc/rc.subr
+
+name="hostname"
+start_cmd="hostname_start"
+stop_cmd=":"
 
-if [ -f /etc/sysctl.conf ]; then
-       while read var comments
-       do
-               case ${var} in
-               \#*|'')
-                       ;;
-               *)
-                       mib=${var%=*}
-                       val=${var#*=}
+hostname_start()
+{
+       # Set the host name if it is not already set
+       #
+       if [ -z "`hostname -s`" ]; then
+               hostname ${hostname}
+               echo "Setting hostname: `hostname`."
+       fi
+}
 
-                       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
+load_rc_config $name
+run_rc_command "$1"
diff --git a/etc/rc.d/ifwatchd b/etc/rc.d/ifwatchd
new file mode 100644 (file)
index 0000000..a52e6e9
--- /dev/null
@@ -0,0 +1,17 @@
+#!/bin/sh
+#
+# $DragonFly: src/etc/rc.d/Attic/ifwatchd,v 1.1 2003/07/24 06:35:37 dillon Exp $
+#
+
+# PROVIDE: ifwatchd
+# REQUIRE: mountcritremote network
+
+. /etc/rc.subr
+
+name="ifwatchd"
+rcvar=$name
+command="/usr/sbin/${name}"
+
+load_rc_config $name
+run_rc_command "$1"
+
diff --git a/etc/rc.d/inetd b/etc/rc.d/inetd
new file mode 100644 (file)
index 0000000..6ca2ed9
--- /dev/null
@@ -0,0 +1,22 @@
+#!/bin/sh
+#
+# $NetBSD: inetd,v 1.6 2000/09/19 13:04:38 lukem Exp $
+# $FreeBSD: src/etc/rc.d/inetd,v 1.2 2002/06/13 22:14:36 gordon Exp $
+# $DragonFly: src/etc/rc.d/inetd,v 1.1 2003/07/24 06:35:37 dillon Exp $
+#
+
+# PROVIDE: inetd
+# REQUIRE: DAEMON LOGIN
+# KEYWORD: DragonFly FreeBSD NetBSD shutdown
+
+. /etc/rc.subr
+
+name="inetd"
+rcvar=`set_rcvar`
+command="/usr/sbin/${name}"
+pidfile="/var/run/${name}.pid"
+required_files="/etc/${name}.conf"
+extra_commands="reload"
+
+load_rc_config $name
+run_rc_command "$1"
similarity index 73%
rename from etc/rc.diskless1
rename to etc/rc.d/initdiskless
index 61e5071..99f22e8 100644 (file)
@@ -1,11 +1,36 @@
-# Copyright (c) 1999-2002  Matt Dillion.  Terms and conditions based on
-# the FreeBSD copyright as found at the base of the source distribution.
-#
-# $FreeBSD: src/etc/rc.diskless1,v 1.5.2.11 2003/04/14 18:12:05 jhay Exp $
-# $DragonFly: src/etc/Attic/rc.diskless1,v 1.2 2003/06/17 04:24:45 dillon Exp $
-#
-# /etc/rc.diskless1 - general BOOTP startup
-#
+#!/bin/sh
+#
+# Copyright (c) 1999  Matt Dillion
+# 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: src/etc/rc.d/initdiskless,v 1.24 2003/06/30 21:47:06 brooks Exp $
+# $DragonFly: src/etc/rc.d/initdiskless,v 1.1 2003/07/24 06:35:37 dillon Exp $
+#
+# PROVIDE: initdiskless
+# KEYWORD: DragonFly FreeBSD
+
 # 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
@@ -55,6 +80,9 @@
 # NOTE!  rc.diskless2 will create /var, /tmp, and /dev.  Those filesystems
 # should not be specified in /conf.  At least not yet.
 
+dlv=`/sbin/sysctl -n vfs.nfs.diskless_valid 2> /dev/null`
+[ ${dlv:=0} -eq 0 ] && exit 0
+
 # chkerr:
 #
 # Routine to check for error
@@ -77,7 +105,7 @@ chkerr() {
 # Create a generic memory disk
 #
 mount_md() {
-    /sbin/mount_mfs -s $1 -T qp120at -b 8192 -f 1024 dummy $2
+    /sbin/mdmfs -i 4096 -s $1 -M md $2
 }
 
 # Create the memory filesystem if it has not already been created
@@ -85,7 +113,7 @@ mount_md() {
 create_md() {
     if [ "x`eval echo \\$md_created_$1`" = "x" ]; then
        if [ "x`eval echo \\$md_size_$1`" = "x" ]; then
-           md_size=8192
+           md_size=4096
        else
            md_size=`eval echo \\$md_size_$1`
        fi
@@ -122,6 +150,17 @@ for i in ${iflist} ; do
 done
 echo "Interface ${bootp_ifc} IP-Address ${bootp_ipa} Broadcast ${bootp_ipbca}"
 
+# Figure out our NFS root path
+# 
+set `mount -t nfs`
+while [ $# -ge 1 ] ; do
+    if [ "$2" = "on" -a "$3" = "/" ]; then
+       nfsroot="$1"
+       break
+    fi
+    shift
+done
+
 # Resolve templates in /conf/base, /conf/default, /conf/${bootp_ipbca},
 # and /conf/${bootp_ipa}.  For each subdirectory found within these 
 # directories:
@@ -137,6 +176,10 @@ echo "Interface ${bootp_ifc} IP-Address ${bootp_ipa} Broadcast ${bootp_ipbca}"
 #   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.
+#   If the diskless_remount file contains a string beginning with a
+#   '/' it is assumed that the local nfsroot should be prepended to
+#   it before attemping to the remount.  This allows the root to be
+#   relocated without needing to change the remount files.
 #
 for i in base default ${bootp_ipbca} ${bootp_ipa} ; do
     for j in /conf/$i/* ; do
@@ -151,6 +194,9 @@ for i in base default ${bootp_ipbca} ${bootp_ipa} ; do
        #
        if [ -d $j -a -f $j/diskless_remount ]; then
            nfspt=`/bin/cat $j/diskless_remount`
+           if [ `expr "$nfspt" : '\(.\)'` = "/" ]; then
+               nfspt="${nfsroot}${nfspt}"
+           fi
            mount_nfs $nfspt $j
            chkerr $? "mount_nfs $nfspt $j"
        fi
@@ -194,12 +240,3 @@ for i in base default ${bootp_ipbca} ${bootp_ipa} ; do
     done
 done
 
-# 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.
-
-diskless_mount="/etc/rc.diskless2"
-
diff --git a/etc/rc.d/initrandom b/etc/rc.d/initrandom
new file mode 100644 (file)
index 0000000..4e1f854
--- /dev/null
@@ -0,0 +1,74 @@
+#!/bin/sh
+#
+# $FreeBSD: src/etc/rc.d/initrandom,v 1.1 2002/06/13 22:14:36 gordon Exp $
+# $DragonFly: src/etc/rc.d/initrandom,v 1.1 2003/07/24 06:35:37 dillon Exp $
+#
+
+# PROVIDE: initrandom
+# REQUIRE: initdiskless
+# BEFORE: disks
+# KEYWORD: DragonFly FreeBSD
+
+. /etc/rc.subr
+
+name="initrandom"
+start_cmd="initrandom_start"
+stop_cmd=":"
+
+feed_dev_random()
+{
+       if [ -f "${1}" -a -r "${1}" -a -s "${1}" ]; then
+               cat "${1}" | dd of=/dev/random bs=8k 2>/dev/null
+       fi
+}
+
+initrandom_start()
+{
+       echo -n 'Entropy harvesting:'
+
+       if checkyesno harvest_interrupt; then
+               if [ -w /dev/random ]; then
+                       ${SYSCTL_W} kern.random.sys.harvest.interrupt=1 >/dev/null
+                       echo -n ' interrupts'
+               fi
+       fi
+
+       if checkyesno harvest_ethernet; then
+               if [ -w /dev/random ]; then
+                       ${SYSCTL_W} kern.random.sys.harvest.ethernet=1 >/dev/null
+                       echo -n ' ethernet'
+               fi
+       fi
+
+       if checkyesno harvest_p_to_p; then
+               if [ -w /dev/random ]; then
+               ${SYSCTL_W} kern.random.sys.harvest.point_to_point=1 >/dev/null
+                       echo -n ' point_to_point'
+               fi
+       fi
+
+       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
+}
+
+load_rc_config random
+run_rc_command "$1"
diff --git a/etc/rc.d/ip6fw b/etc/rc.d/ip6fw
new file mode 100644 (file)
index 0000000..b580700
--- /dev/null
@@ -0,0 +1,59 @@
+#!/bin/sh
+#
+# $FreeBSD: src/etc/rc.d/ip6fw,v 1.3 2003/06/29 05:15:57 mtm Exp $
+# $DragonFly: src/etc/rc.d/ip6fw,v 1.1 2003/07/24 06:35:37 dillon Exp $
+#
+
+# PROVIDE: ip6fw
+# REQUIRE: routing
+# BEFORE: network_ipv6
+# KEYWORD: DragonFly FreeBSD
+
+. /etc/rc.subr
+
+name="ip6fw"
+rcvar=`set_rcvar ipv6_firewall`
+start_cmd="ip6fw_start"
+start_precmd="ip6fw_prestart"
+stop_cmd="${SYSCTL_W} net.inet6.ip6.fw.enable=0"
+
+ip6fw_prestart()
+{
+       # Load IPv6 firewall module, if not already loaded
+       if ! ${SYSCTL} net.inet6.ip6.fw.enable > /dev/null 2>&1; then
+               kldload ip6fw && {
+                       debug 'Kernel IPv6 firewall module loaded.'
+                       return 0
+               }
+               warn 'IPv6 firewall kernel module failed to load.'
+               return 1
+       fi
+}
+
+ip6fw_start()
+{
+       # Specify default rules file if none provided
+       if [ -z "${ipv6_firewall_script}" ]; then
+               ipv6_firewall_script=/etc/rc.firewall6
+       fi
+
+       # Load rules
+       #
+       if [ -r "${ipv6_firewall_script}" ]; then
+               . "${ipv6_firewall_script}"
+               echo 'IPv6 Firewall rules loaded.'
+       elif [ "`ip6fw l 65535`" = "65535 deny ipv6 from any to any" ]; then
+               warn 'IPv6 firewall rules have not been loaded. Default' \
+                   ' to DENY all access.'
+       fi
+
+       # Enable firewall logging
+       #
+       if checkyesno ipv6_firewall_logging; then
+               echo 'IPv6 Firewall logging=YES'
+               sysctl net.inet6.ip6.fw.verbose=1 >/dev/null
+       fi
+}
+
+load_rc_config $name
+run_rc_command "$1"
diff --git a/etc/rc.d/ipfilter b/etc/rc.d/ipfilter
new file mode 100644 (file)
index 0000000..d3b8d86
--- /dev/null
@@ -0,0 +1,227 @@
+#!/bin/sh
+#
+# $NetBSD: ipfilter,v 1.10 2001/02/28 17:03:50 lukem Exp $
+# $FreeBSD: src/etc/rc.d/ipfilter,v 1.10 2003/04/30 02:54:17 mtm Exp $
+# $DragonFly: src/etc/rc.d/ipfilter,v 1.1 2003/07/24 06:35:37 dillon Exp $
+#
+
+# PROVIDE: ipfilter
+# REQUIRE: root beforenetlkm mountcritlocal tty ipmon
+# BEFORE:  netif
+# KEYWORD: DragonFly FreeBSD NetBSD
+
+. /etc/rc.subr
+
+name="ipfilter"
+rcvar=`set_rcvar`
+load_rc_config $name
+
+case ${OSTYPE} in
+DragonFly)
+       stop_precmd="test -f ${ipfilter_rules} -o -f ${ipv6_ipfilter_rules}"
+        ;;
+
+FreeBSD)
+       stop_precmd="test -f ${ipfilter_rules} -o -f ${ipv6_ipfilter_rules}"
+       ;;
+NetBSD)
+       stop_precmd="test -f /etc/ipf.conf -o -f /etc/ipf6.conf"
+       ;;
+esac
+
+start_precmd="ipfilter_prestart"
+start_cmd="ipfilter_start"
+stop_cmd="ipfilter_stop"
+reload_precmd="$stop_precmd"
+reload_cmd="ipfilter_reload"
+resync_precmd="$stop_precmd"
+resync_cmd="ipfilter_resync"
+status_precmd="$stop_precmd"
+status_cmd="ipfilter_status"
+extra_commands="reload resync status"
+
+ipfilter_prestart()
+{
+case ${OSTYPE} in
+DragonFly)
+        # load ipfilter kernel module if needed
+        if ! sysctl net.inet.ipf.fr_pass > /dev/null 2>&1; then
+                if kldload ipl; then
+                        info 'IP-filter module loaded.'
+                else
+                        err 1 'IP-filter module failed to load.'
+                fi
+        fi
+        # check for ipfilter rules
+        if [ ! -r "${ipfilter_rules}" ] && [ ! -r "${ipv6_ipfilter_rules}" ]
+        then
+                warn 'IP-filter: NO IPF RULES'
+                return 1
+        fi
+        ;;
+
+FreeBSD)
+       # load ipfilter kernel module if needed
+       if ! sysctl net.inet.ipf.fr_pass > /dev/null 2>&1; then
+               if kldload ipl; then
+                       info 'IP-filter module loaded.'
+               else
+                       err 1 'IP-filter module failed to load.'
+               fi
+       fi
+
+       # check for ipfilter rules
+       if [ ! -r "${ipfilter_rules}" ] && [ ! -r "${ipv6_ipfilter_rules}" ]
+       then
+               warn 'IP-filter: NO IPF RULES'
+               return 1
+       fi
+       ;;
+NetBSD)
+       if [ ! -f /etc/ipf.conf ] && [ ! -f /etc/ipf6.conf ]; then
+               warn "/etc/ipf*.conf not readable; ipfilter start aborted."
+                       #
+                       # If booting directly to multiuser, send SIGTERM to
+                       # the parent (/etc/rc) to abort the boot
+                       #
+               if [ "$autoboot" = yes ]; then
+                       echo "ERROR: ABORTING BOOT (sending SIGTERM to parent)!"
+                       kill -TERM $$
+                       exit 1
+               fi
+               return 1
+       fi
+       ;;
+esac
+       return 0
+}
+
+ipfilter_start()
+{
+       echo "Enabling ipfilter."
+       case ${OSTYPE} in
+       DragonFly)
+                ${ipfilter_program:-/sbin/ipf} -EFa
+                if [ -r "${ipfilter_rules}" ]; then
+                        ${ipfilter_program:-/sbin/ipf} \
+                            -f "${ipfilter_rules}" ${ipfilter_flags}
+                fi
+                ${ipfilter_program:-/sbin/ipf} -6 -EFa
+                if [ -r "${ipv6_ipfilter_rules}" ]; then
+                        ${ipfilter_program:-/sbin/ipf} -6 \
+                            -f "${ipv6_ipfilter_rules}" ${ipfilter_flags}
+                fi
+                ;;
+
+       FreeBSD)
+               ${ipfilter_program:-/sbin/ipf} -EFa
+               if [ -r "${ipfilter_rules}" ]; then
+                       ${ipfilter_program:-/sbin/ipf} \
+                           -f "${ipfilter_rules}" ${ipfilter_flags}
+               fi
+               ${ipfilter_program:-/sbin/ipf} -6 -EFa
+               if [ -r "${ipv6_ipfilter_rules}" ]; then
+                       ${ipfilter_program:-/sbin/ipf} -6 \
+                           -f "${ipv6_ipfilter_rules}" ${ipfilter_flags}
+               fi
+               ;;
+       NetBSD)
+               /sbin/ipf -E -Fa
+               if [ -f /etc/ipf.conf ]; then
+                       /sbin/ipf -f /etc/ipf.conf
+               fi
+               if [ -f /etc/ipf6.conf ]; then
+                       /sbin/ipf -6 -f /etc/ipf6.conf
+               fi
+               ;;
+       esac
+}
+
+ipfilter_stop()
+{
+       case ${OSTYPE} in
+       DragonFly)
+               echo "Saving firewall state tables"
+                ${ipfs_program:-/sbin/ipfs} -W ${ipfs_flags}
+                ;;
+       FreeBSD)
+               echo "Saving firewall state tables"
+               ${ipfs_program:-/sbin/ipfs} -W ${ipfs_flags}
+               ;;
+       NetBSD)
+               ;;
+       esac
+       # XXX - The following command is not effective for 'lkm's
+       echo "Disabling ipfilter."
+       /sbin/ipf -D
+}
+
+ipfilter_reload()
+{
+       echo "Reloading ipfilter rules."
+
+       case ${OSTYPE} in
+       DragonFly)
+                ${ipfilter_program:-/sbin/ipf} -I -Fa
+                if [ -r "${ipfilter_rules}" ]; then
+                        ${ipfilter_program:-/sbin/ipf} -I \
+                            -f "${ipfilter_rules}" ${ipfilter_flags}
+                fi
+                ${ipfilter_program:-/sbin/ipf} -I -6 -Fa
+                if [ -r "${ipv6_ipfilter_rules}" ]; then
+                        ${ipfilter_program:-/sbin/ipf} -I -6 \
+                            -f "${ipv6_ipfilter_rules}" ${ipfilter_flags}
+                fi
+                ${ipfilter_program:-/sbin/ipf} -s
+                ;;
+       FreeBSD)
+               ${ipfilter_program:-/sbin/ipf} -I -Fa
+               if [ -r "${ipfilter_rules}" ]; then
+                       ${ipfilter_program:-/sbin/ipf} -I \
+                           -f "${ipfilter_rules}" ${ipfilter_flags}
+               fi
+               ${ipfilter_program:-/sbin/ipf} -I -6 -Fa
+               if [ -r "${ipv6_ipfilter_rules}" ]; then
+                       ${ipfilter_program:-/sbin/ipf} -I -6 \
+                           -f "${ipv6_ipfilter_rules}" ${ipfilter_flags}
+               fi
+               ${ipfilter_program:-/sbin/ipf} -s
+               ;;
+       NetBSD)
+               /sbin/ipf -I -Fa
+               if [ -f /etc/ipf.conf ] && ! /sbin/ipf -I -f /etc/ipf.conf; then
+                       err 1 "reload of ipf.conf failed; not swapping to" \
+                           " new ruleset."
+               fi
+               if [ -f /etc/ipf6.conf ] && \
+                   ! /sbin/ipf -I -6 -f /etc/ipf6.conf; then
+                       err 1 "reload of ipf6.conf failed; not swapping to" \
+                           " new ruleset."
+               fi
+               /sbin/ipf -s
+               ;;
+       esac
+
+}
+
+ipfilter_resync()
+{
+       case ${OSTYPE} in
+       DragonFly)
+               # Don't resync if ipfilter is not loaded
+                [ sysctl net.inet.ipf.fr_pass > /dev/null 2>&1 ] && return
+                ;;
+       FreeBSD)
+               # Don't resync if ipfilter is not loaded
+               [ sysctl net.inet.ipf.fr_pass > /dev/null 2>&1 ] && return
+               ;;
+       esac
+       ${ipfilter_program:-/sbin/ipf} -y ${ipfilter_flags}
+}
+
+ipfilter_status()
+{
+       ${ipfilter_program:-/sbin/ipf} -V
+}
+
+run_rc_command "$1"
diff --git a/etc/rc.d/ipfs b/etc/rc.d/ipfs
new file mode 100644 (file)
index 0000000..46286b3
--- /dev/null
@@ -0,0 +1,64 @@
+#!/bin/sh
+#
+# $NetBSD: ipfs,v 1.3 2002/02/11 13:55:42 lukem Exp $
+# $FreeBSD: src/etc/rc.d/ipfs,v 1.2 2003/04/24 08:20:47 mtm Exp $
+# $DragonFly: src/etc/rc.d/ipfs,v 1.1 2003/07/24 06:35:37 dillon Exp $
+#
+
+# PROVIDE: ipfs
+# REQUIRE: ipnat
+# BEFORE:  netif
+# KEYWORD: DragonFly FreeBSD NetBSD shutdown
+
+. /etc/rc.subr
+
+name="ipfs"
+rcvar=`set_rcvar`
+start_cmd="ipfs_start"
+stop_cmd="ipfs_stop"
+case ${OSTYPE} in
+DragonFly)
+       start_precmd="ipfs_prestart"
+        ;;
+FreeBSD)
+       start_precmd="ipfs_prestart"
+       ;;
+NetBSD)
+       ipfs_program="/usr/sbin/ipfs"
+       ;;
+esac
+
+ipfs_prestart()
+{
+       # Do not continue if either ipnat or ipfilter is not enabled or
+       # if the ipfilter module is not loaded.
+       #
+       if ! checkyesno ipfilter_enable -o ! checkyesno ipnat_enable ; then
+               err 1  "${name} requires either ipfilter or ipnat enabled"
+       fi
+       if ! sysctl net.inet.ipf.fr_pass >/dev/null 2>&1; then
+               err 1 "ipfilter module is not loaded"
+       fi
+       return 0
+}
+
+ipfs_start()
+{
+       if [ -r /var/db/ipf/ipstate.ipf -a -r /var/db/ipf/ipnat.ipf ]; then
+               ${ipfs_program} -R ${rc_flags}
+               rm -f /var/db/ipf/ipstate.ipf /var/db/ipf/ipnat.ipf
+       fi
+}
+
+ipfs_stop()
+{
+       if [ ! -d /var/db/ipf ]; then
+               mkdir /var/db/ipf
+               chmod 700 /var/db/ipf
+               chown root:wheel /var/db/ipf
+       fi
+       ${ipfs_program} -W ${rc_flags}
+}
+
+load_rc_config $name
+run_rc_command "$1"
diff --git a/etc/rc.d/ipfw b/etc/rc.d/ipfw
new file mode 100644 (file)
index 0000000..2050084
--- /dev/null
@@ -0,0 +1,82 @@
+#!/bin/sh
+#
+# $FreeBSD: src/etc/rc.d/ipfw,v 1.4 2003/03/30 15:52:18 mtm Exp $
+# $DragonFly: src/etc/rc.d/ipfw,v 1.1 2003/07/24 06:35:37 dillon Exp $
+#
+
+# PROVIDE: ipfw
+# REQUIRE: ppp-user
+# BEFORE: NETWORKING
+# KEYWORD: DragonFly FreeBSD
+
+. /etc/rc.subr
+
+name="ipfw"
+rcvar="firewall_enable"
+start_cmd="ipfw_start"
+start_precmd="ipfw_precmd"
+stop_cmd="ipfw_stop"
+
+ipfw_precmd()
+{
+       if ! ${SYSCTL} net.inet.ip.fw.enable > /dev/null 2>&1; then
+               if ! kldload ipfw; then
+                       warn unable to load firewall module.
+                       return 1
+               fi
+       fi
+
+       return 0
+}
+
+ipfw_start()
+{
+       # set the firewall rules script if none was specified
+       [ -z "${firewall_script}" ] && firewall_script=/etc/rc.firewall
+
+       if [ -r "${firewall_script}" ]; then
+               . "${firewall_script}"
+               echo -n 'Firewall rules loaded, starting divert daemons:'
+
+               # Network Address Translation daemon
+               #
+               if checkyesno natd_enable; then
+                       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} ${natd_ifarg}
+               fi
+       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
+       echo '.'
+
+       # Firewall logging
+       #
+       if checkyesno firewall_logging; then
+               echo 'Firewall logging enabled'
+               sysctl net.inet.ip.fw.verbose=1 >/dev/null
+       fi
+
+       # Enable the firewall
+       #
+       ${SYSCTL_W} net.inet.ip.fw.enable=1
+}
+
+ipfw_stop()
+{
+       # Disable the firewall
+       #
+       ${SYSCTL_W} net.inet.ip.fw.enable=0
+}
+
+load_rc_config $name
+run_rc_command "$1"
diff --git a/etc/rc.d/ipmon b/etc/rc.d/ipmon
new file mode 100644 (file)
index 0000000..628705f
--- /dev/null
@@ -0,0 +1,47 @@
+#!/bin/sh
+#
+# $NetBSD: ipmon,v 2002/04/18 05:02:01 lukem Exp $
+# $FreeBSD: src/etc/rc.d/ipmon,v 1.6 2003/07/14 13:02:36 mtm Exp $
+# $DragonFly: src/etc/rc.d/ipmon,v 1.1 2003/07/24 06:35:37 dillon Exp $
+#
+
+# PROVIDE: ipmon
+# REQUIRE: mountcritlocal hostname sysctl cleanvar
+# BEFORE:  SERVERS
+# KEYWORD: DragonFly FreeBSD NetBSD
+
+. /etc/rc.subr
+
+name="ipmon"
+rcvar=`set_rcvar`
+
+case ${OSTYPE} in
+DragonFly)
+       command="/sbin/ipmon"
+        start_precmd="ipmon_precmd"
+        ;;
+FreeBSD)
+       command="/sbin/ipmon"
+       start_precmd="ipmon_precmd"
+       ;;
+NetBSD)
+       command="/usr/sbin/${name}"
+       command_args="-D"
+esac
+
+ipmon_precmd()
+{
+       # Continue only if ipfilter or ipnat is enabled and the
+       # ipfilter module is loaded.
+       #
+       if ! checkyesno ipfilter_enable -o ! checkyesno ipnat_enable ; then
+               err 1  "${name} requires either ipfilter or ipnat enabled"
+       fi
+       if ! sysctl net.inet.ipf.fr_pass >/dev/null 2>&1; then
+               err 1 "ipfilter module is not loaded"
+       fi
+       return 0
+}
+
+load_rc_config $name
+run_rc_command "$1"
diff --git a/etc/rc.d/ipnat b/etc/rc.d/ipnat
new file mode 100644 (file)
index 0000000..7cd2f12
--- /dev/null
@@ -0,0 +1,66 @@
+#!/bin/sh
+#
+# $NetBSD: ipnat,v 1.6 2000/09/19 13:04:38 lukem Exp $
+# $FreeBSD: src/etc/rc.d/ipnat,v 1.8 2003/04/30 02:54:17 mtm Exp $
+# $DragonFly: src/etc/rc.d/ipnat,v 1.1 2003/07/24 06:35:37 dillon Exp $
+#
+
+# PROVIDE: ipnat
+# REQUIRE: ipfilter
+# BEFORE:  DAEMON netif
+# KEYWORD: DragonFly FreeBSD NetBSD
+
+. /etc/rc.subr
+
+name="ipnat"
+rcvar=`set_rcvar`
+load_rc_config $name
+
+case ${OSTYPE} in
+NetBSD)
+       ipnat_flags=
+       ipnat_rules="/etc/ipnat.conf"
+       ipnat_program="/usr/sbin/ipnat"
+       ;;
+esac
+
+start_precmd="ipnat_precmd"
+start_cmd="ipnat_start"
+stop_cmd="${ipnat_program} -F -C"
+reload_cmd="${ipnat_program} -F -C -f ${ipnat_rules}"
+extra_commands="reload"
+
+ipnat_precmd()
+{
+       case ${OSTYPE} in
+       NetBSD)
+               if ! checkyesno ipfilter || [ ! -f /etc/ipf.conf ]; then        
+                       echo "Enabling ipfilter for NAT."
+                       /sbin/ipf -E -Fa
+               fi
+               return 0
+               ;;
+       esac
+
+       # Make sure ipfilter is loaded before continuing
+       if ! ${SYSCTL} net.inet.ipf.fr_pass >/dev/null 2>&1; then
+               if kldload ipl; then
+                       info 'IP-filter module loaded.'
+               else
+                       err 1 'IP-filter module failed to load.'
+               fi
+       fi
+       return 0
+}
+
+ipnat_start()
+{
+       if [ ! -f ${ipnat_rules} ]; then
+               warn 'NO IPNAT RULES'
+               return 0
+       fi
+       echo -n "Installing NAT rules."
+       ${ipnat_program} -CF -f ${ipnat_rules} ${ipnat_flags}
+}
+
+run_rc_command "$1"
diff --git a/etc/rc.d/ipsec b/etc/rc.d/ipsec
new file mode 100644 (file)
index 0000000..bf2983e
--- /dev/null
@@ -0,0 +1,87 @@
+#!/bin/sh
+#
+# $NetBSD: ipsec,v 1.7 2002/03/22 04:33:58 thorpej Exp $
+# $FreeBSD: src/etc/rc.d/ipsec,v 1.5 2003/02/16 20:46:08 mtm Exp $
+# $DragonFly: src/etc/rc.d/ipsec,v 1.1 2003/07/24 06:35:37 dillon Exp $
+#
+
+# PROVIDE: ipsec
+# REQUIRE: root beforenetlkm mountcritlocal tty
+# BEFORE:  DAEMON
+# KEYWORD: DragonFly FreeBSD NetBSD
+
+#      it does not really require beforenetlkm.
+
+. /etc/rc.subr
+
+name="ipsec"
+rcvar=`set_rcvar`
+start_precmd="ipsec_prestart"
+start_cmd="ipsec_start"
+stop_precmd="test -f /etc/ipsec.conf"
+stop_cmd="ipsec_stop"
+reload_cmd="ipsec_reload"
+extra_commands="reload"
+
+case ${OSTYPE} in
+DragonFly)
+       ipsec_program="/usr/sbin/setkey"
+        # ipsec_file is set by rc.conf
+        ;;
+
+FreeBSD)
+       ipsec_program="/usr/sbin/setkey"
+       # ipsec_file is set by rc.conf
+       ;;
+NetBSD)
+       ipsec_program="/sbin/setkey"
+       ipsec_file="/etc/ipsec.conf"
+       ;;
+esac
+
+ipsec_prestart()
+{
+       if [ ! -f "$ipsec_file" ]; then
+               warn "$ipsec_file not readable; ipsec start aborted."
+                       #
+                       # If booting directly to multiuser, send SIGTERM to
+                       # the parent (/etc/rc) to abort the boot
+                       #
+               if [ "$autoboot" = yes ]; then
+                       echo "ERROR: ABORTING BOOT (sending SIGTERM to parent)!"
+                       kill -TERM $$
+                       exit 1
+               fi
+               return 1
+       fi
+       return 0
+}
+
+ipsec_start()
+{
+       echo "Installing ipsec manual keys/policies."
+       ${ipsec_program} -f $ipsec_file
+}
+
+ipsec_stop()
+{
+       echo "Clearing ipsec manual keys/policies."
+
+       # still not 100% sure if we would like to do this.
+       # it is very questionable to do this during shutdown session, since
+       # it can hang any of remaining IPv4/v6 session.
+       #
+       ${ipsec_program} -F
+       ${ipsec_program} -FP
+}
+
+ipsec_reload()
+{
+       echo "Reloading ipsec manual keys/policies."
+       ${ipsec_program} -F
+       ${ipsec_program} -FP
+       ${ipsec_program} -f "$ipsec_file"
+}
+
+load_rc_config $name
+run_rc_command "$1"
diff --git a/etc/rc.d/ipxrouted b/etc/rc.d/ipxrouted
new file mode 100644 (file)
index 0000000..c4330c4
--- /dev/null
@@ -0,0 +1,20 @@
+#!/bin/sh
+#
+# $FreeBSD: src/etc/rc.d/ipxrouted,v 1.1 2002/06/13 22:14:36 gordon Exp $
+# $DragonFly: src/etc/rc.d/ipxrouted,v 1.1 2003/07/24 06:35:37 dillon Exp $
+#
+
+# PROVIDE: ipxrouted
+# REQUIRE: SERVERS
+# BEFORE: DAEMON
+# KEYWORD: DragonFly FreeBSD
+
+. /etc/rc.subr
+
+name="ipxrouted"
+rcvar=`set_rcvar`
+command="/usr/sbin/IPXrouted"
+command_args="> /dev/null 2>&1"
+
+load_rc_config $name
+run_rc_command "$1"
diff --git a/etc/rc.d/isdnd b/etc/rc.d/isdnd
new file mode 100644 (file)
index 0000000..d49c28f
--- /dev/null
@@ -0,0 +1,79 @@
+#!/bin/sh
+#
+# $NetBSD: isdnd,v 1.9 2002/04/10 23:37:13 martin Exp $
+# $FreeBSD: src/etc/rc.d/isdnd,v 1.15 2003/07/15 12:39:37 mtm Exp $
+# $DragonFly: src/etc/rc.d/isdnd,v 1.1 2003/07/24 06:35:37 dillon Exp $
+#
+# Mostly based on original script (/etc/rc.isdn) written by  Hellmuth Michaelis
+#
+
+# PROVIDE: isdnd
+# REQUIRE: netif mountcritlocal
+# KEYWORD: DragonFly FreeBSD NetBSD
+
+. /etc/rc.subr
+
+name="isdnd"
+rcvar=`set_rcvar isdn`
+pidfile="/var/run/${name}.pid"
+
+case ${OSTYPE} in
+DragonFly)
+       start_cmd="isdnd_start"
+        ;;
+FreeBSD)
+       start_cmd="isdnd_start"
+       ;;
+NetBSD)
+       command="/usr/sbin/${name}"
+       required_files="/etc/isdn/${name}.rc"
+       ;;
+esac
+
+isdnd_start()
+{
+       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
+
+       # Start isdnd
+       #
+       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])
+                       ;;
+               *)
+                       /usr/sbin/vidcontrol < ${isdn_fsdev} > ${isdn_fsdev} 2>&1 ${isdn_screenflags}
+                       ;;
+               esac
+
+               /usr/sbin/isdnd ${isdn_flags} -f -r ${isdn_fsdev} -t ${isdn_ttype}
+               ;;
+       esac
+
+       # Start isdntrace
+       #
+       if checkyesno isdn_trace; then
+               echo -n ' isdntrace'
+               nohup /usr/sbin/isdntrace ${isdn_traceflags} >/dev/null 2>&1 &
+       fi
+       echo '.'
+}
+
+load_rc_config $name
+run_rc_command "$1"
diff --git a/etc/rc.d/jail b/etc/rc.d/jail
new file mode 100644 (file)
index 0000000..71b7516
--- /dev/null
@@ -0,0 +1,70 @@
+#!/bin/sh
+#
+# $FreeBSD: src/etc/rc.d/jail,v 1.4 2003/05/05 15:38:41 mtm Exp $
+# $DragonFly: src/etc/rc.d/jail,v 1.1 2003/07/24 06:35:37 dillon Exp $
+#
+
+# PROVIDE: jail
+# REQUIRE: LOGIN
+# BEFORE: securelevel
+# KEYWORD: DragonFly FreeBSD
+
+. /etc/rc.subr
+
+name="jail"
+rcvar=`set_rcvar`
+start_cmd="jail_start"
+stop_cmd="jail_stop"
+
+jail_start()
+{
+       echo -n 'Configuring jails:'
+       echo -n ' set_hostname_allowed='
+       if checkyesno jail_set_hostname_allow ; then 
+               echo -n 'YES'
+               ${SYSCTL_W} 1>/dev/null security.jail.set_hostname_allowed=1
+       else
+               echo -n 'NO'
+               ${SYSCTL_W} 1>/dev/null security.jail.set_hostname_allowed=0
+       fi
+
+       echo -n ' unixiproute_only='
+       if checkyesno jail_socket_unixiproute_only ; then 
+               echo -n 'YES'
+               ${SYSCTL_W} 1>/dev/null security.jail.socket_unixiproute_only=1
+       else
+               echo -n 'NO'
+               ${SYSCTL_W} 1>/dev/null security.jail.socket_unixiproute_only=0
+       fi
+
+       echo -n ' sysvipc_allow='
+       if checkyesno jail_sysvipc_allow ; then
+               echo -n 'YES'
+               ${SYSCTL_W} 1>/dev/null security.jail.sysvipc_allowed=1
+       else
+               echo -n 'NO'
+               ${SYSCTL_W} 1>/dev/null security.jail.sysvipc_allowed=0
+       fi
+       echo '.'
+
+       echo 'Starting Jails.'
+       for _jail in ${jail_list} 
+       do
+               eval jail_rootdir=\"\$jail_${_jail}_rootdir\"
+               eval jail_hostname=\"\$jail_${_jail}_hostname\"
+               eval jail_ip=\"\$jail_${_jail}_ip\"
+               eval jail_exec=\"\$jail_${_jail}_exec\"
+               [ -z ${jail_exec} ] && jail_exec="/bin/sh /etc/rc"
+               
+               jail ${jail_rootdir} ${jail_hostname} ${jail_ip} ${jail_exec}
+       done
+}
+
+jail_stop()
+{
+       kill -TERM $(ps aux | awk '$8 ~ /.*J/ {print  $2};')
+}
+
+
+load_rc_config $name
+run_rc_command "$1"
diff --git a/etc/rc.d/kadmind b/etc/rc.d/kadmind
new file mode 100644 (file)
index 0000000..b601a51
--- /dev/null
@@ -0,0 +1,22 @@
+#!/bin/sh
+#
+# $FreeBSD: src/etc/rc.d/kadmind,v 1.3 2003/03/08 09:50:10 markm Exp $
+# $DragonFly: src/etc/rc.d/kadmind,v 1.1 2003/07/24 06:35:37 dillon Exp $
+#
+
+# PROVIDE: kadmin
+# REQUIRE: kerberos
+# BEFORE: DAEMON
+# KEYWORD: DragonFly FreeBSD
+
+. /etc/rc.subr
+
+name="kadmind5"
+load_rc_config $name
+rcvar="kadmind5_server_enable"
+unset start_cmd
+command="${kadmind5_server}"
+command_args="&"
+required_vars="kerberos5_server_enable"
+
+run_rc_command "$1"
diff --git a/etc/rc.d/kdc b/etc/rc.d/kdc
new file mode 100644 (file)
index 0000000..0e25083
--- /dev/null
@@ -0,0 +1,21 @@
+#!/bin/sh
+#
+# $NetBSD: kdc,v 1.5 2002/03/22 04:33:58 thorpej Exp $
+# $FreeBSD: src/etc/rc.d/kdc,v 1.2 2002/06/13 22:14:36 gordon Exp $
+# $DragonFly: src/etc/rc.d/Attic/kdc,v 1.1 2003/07/24 06:35:37 dillon Exp $
+#
+
+# PROVIDE: kdc
+# REQUIRE: NETWORKING
+# BEFORE:  SERVERS
+
+. /etc/rc.subr
+
+name="kdc"
+rcvar=$name
+command="/usr/sbin/${name}"
+pidfile="/var/run/${name}.pid"
+required_files="/etc/krb5.conf"
+
+load_rc_config $name
+run_rc_command "$1"
diff --git a/etc/rc.d/kerberos b/etc/rc.d/kerberos
new file mode 100644 (file)
index 0000000..5217217
--- /dev/null
@@ -0,0 +1,19 @@
+#!/bin/sh
+#
+# $FreeBSD: src/etc/rc.d/kerberos,v 1.3 2003/03/08 09:50:10 markm Exp $
+# $DragonFly: src/etc/rc.d/kerberos,v 1.1 2003/07/24 06:35:37 dillon Exp $
+#
+
+# PROVIDE: kerberos
+# REQUIRE: NETWORKING
+# KEYWORD: DragonFly FreeBSD
+
+. /etc/rc.subr
+
+name="kerberos5"
+load_rc_config $name
+rcvar="kerberos5_server_enable"
+command="${kerberos5_server}"
+command_args="&"
+
+run_rc_command "$1"
diff --git a/etc/rc.d/keyserv b/etc/rc.d/keyserv
new file mode 100644 (file)
index 0000000..16f7585
--- /dev/null
@@ -0,0 +1,34 @@
+#!/bin/sh
+#
+# $FreeBSD: src/etc/rc.d/keyserv,v 1.2 2002/08/14 05:44:32 gordon Exp $
+# $DragonFly: src/etc/rc.d/keyserv,v 1.1 2003/07/24 06:35:37 dillon Exp $
+#
+
+# Start keyserv if we are running Secure RPC
+#
+
+# PROVIDE: keyserv
+# REQUIRE: ypbind
+# BEFORE: DAEMON
+# KEYWORD: DragonFly FreeBSD
+
+. /etc/rc.subr
+
+name="keyserv"
+rcvar=`set_rcvar`
+command="/usr/sbin/${name}"
+start_precmd="keyserv_prestart"
+
+keyserv_prestart()
+{
+       if ! checkyesno rpcbind_enable  && \
+               ! /etc/rc.d/rpcbind forcestatus 1>/dev/null 2>&1
+       then
+               force_depend rpcbind || return 1
+       fi
+
+       return 0
+}
+
+load_rc_config $name
+run_rc_command "$1"
diff --git a/etc/rc.d/kldxref b/etc/rc.d/kldxref
new file mode 100644 (file)
index 0000000..087cb9b
--- /dev/null
@@ -0,0 +1,36 @@
+#!/bin/sh
+#
+# $FreeBSD: src/etc/rc.d/kldxref,v 1.2 2003/04/18 17:55:05 mtm Exp $
+# $DragonFly: src/etc/rc.d/Attic/kldxref,v 1.1 2003/07/24 06:35:37 dillon Exp $
+#
+
+# PROVIDE: kldxref
+# REQUIRE: root mountcritlocal
+# BEFORE:  netif
+# KEYWORD: DragonFly FreeBSD
+
+. /etc/rc.subr
+
+rcvar="kldxref_enable"
+name="kldxref"
+stop_cmd=":"
+start_cmd="kldxref_start"
+
+kldxref_start () {
+       if [ -n "$kldxref_module_path" ]; then
+               MODULE_PATHS="$kldxref_module_path"
+       else
+               MODULE_PATHS=`sysctl -n kern.module_path`
+       fi
+       IFS=';'
+       for MODULE_DIR in $MODULE_PATHS; do
+               if [ ! -f "$MODULE_DIR/linker.hints" ] ||
+                   checkyesno kldxref_clobber; then
+                       echo "Building $MODULE_DIR/linker.hints"
+                       kldxref "$MODULE_DIR"
+               fi
+       done
+}
+
+load_rc_config $name
+run_rc_command "$1"
diff --git a/etc/rc.d/kpasswdd b/etc/rc.d/kpasswdd
new file mode 100644 (file)
index 0000000..4795046
--- /dev/null
@@ -0,0 +1,22 @@
+#!/bin/sh
+#
+# $FreeBSD: src/etc/rc.d/kpasswdd,v 1.2 2003/05/06 02:28:03 mtm Exp $
+# $DragonFly: src/etc/rc.d/kpasswdd,v 1.1 2003/07/24 06:35:37 dillon Exp $
+#
+
+# PROVIDE: kpasswdd
+# REQUIRE: kadmin
+# BEFORE: DAEMON
+# KEYWORD: DragonFly FreeBSD
+
+. /etc/rc.subr
+
+name="kpasswdd"
+load_rc_config $name
+rcvar="kpasswdd_server_enable"
+unset start_cmd
+command="${kpasswdd_server}"
+command_args="&"
+required_vars="kadmind5_server_enable"
+
+run_rc_command "$1"
diff --git a/etc/rc.d/ldconfig b/etc/rc.d/ldconfig
new file mode 100644 (file)
index 0000000..d559c02
--- /dev/null
@@ -0,0 +1,97 @@
+#!/bin/sh
+#
+# $NetBSD: ldconfig,v 1.5 2002/03/22 04:33:58 thorpej Exp $
+# $FreeBSD: src/etc/rc.d/ldconfig,v 1.7 2003/06/30 15:02:05 trhodes Exp $
+# $DragonFly: src/etc/rc.d/ldconfig,v 1.1 2003/07/24 06:35:37 dillon Exp $
+#
+
+# PROVIDE: ldconfig
+# REQUIRE: mountall mountcritremote
+# BEFORE:  DAEMON
+# KEYWORD: DragonFly FreeBSD NetBSD
+
+. /etc/rc.subr
+
+name="ldconfig"
+ldconfig_command="/sbin/ldconfig"
+start_cmd="ldconfig_start"
+stop_cmd=":"
+
+ldconfig_start()
+{
+       case ${OSTYPE} in
+       DragonFly)
+               _ins=
+                ldconfig=${ldconfig_command}
+                checkyesno ldconfig_insecure && _ins="-i"
+                if [ -x "${ldconfig_command}" ]; then
+                        _LDC=/usr/lib
+                        for i in ${ldconfig_paths} /etc/ld-elf.so.conf; do
+                                if [ -r "${i}" ]; then
+                                        _LDC="${_LDC} ${i}"
+                                fi
+                        done
+                        echo 'ELF ldconfig path:' ${_LDC}
+                        ${ldconfig} -elf ${_ins} ${_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} /etc/ld.so.conf; do
+                                       if [ -r "${i}" ]; then
+                                                _LDC="${_LDC} ${i}"
+                                        fi
+                                done
+                                echo 'a.out ldconfig path:' ${_LDC}
+                                ${ldconfig} -aout ${_ins} ${_LDC}
+                                ;;
+                        esac
+                fi
+                ;;
+
+       FreeBSD)
+               _ins=
+               ldconfig=${ldconfig_command}
+               checkyesno ldconfig_insecure && _ins="-i"
+               if [ -x "${ldconfig_command}" ]; then
+                       _LDC=/usr/lib
+                       for i in ${ldconfig_paths} /etc/ld-elf.so.conf; do
+                               if [ -r "${i}" ]; then
+                                       _LDC="${_LDC} ${i}"
+                               fi
+                       done
+                       echo 'ELF ldconfig path:' ${_LDC}
+                       ${ldconfig} -elf ${_ins} ${_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} /etc/ld.so.conf; do
+                                       if [ -r "${i}" ]; then
+                                               _LDC="${_LDC} ${i}"
+                                       fi
+                               done
+                               echo 'a.out ldconfig path:' ${_LDC}
+                               ${ldconfig} -aout ${_ins} ${_LDC}
+                               ;;
+                       esac
+               fi
+               ;;
+       NetBSD)
+               if [ -f ${ldconfig_command} ]; then
+                       echo "Creating a.out runtime link editor directory cache."
+                       ${ldconfig_command}
+               fi
+               ;;
+       *)
+               ;;
+       esac
+}
+
+load_rc_config $name
+run_rc_command "$1"
diff --git a/etc/rc.d/lkm1 b/etc/rc.d/lkm1
new file mode 100644 (file)
index 0000000..07ece30
--- /dev/null
@@ -0,0 +1,41 @@
+#!/bin/sh
+#
+# $NetBSD: lkm1,v 1.6 2000/10/09 06:11:38 nisimura Exp $
+# $FreeBSD: src/etc/rc.d/lkm1,v 1.2 2002/06/13 22:14:36 gordon Exp $
+# $DragonFly: src/etc/rc.d/Attic/lkm1,v 1.1 2003/07/24 06:35:37 dillon Exp $
+#
+
+# PROVIDE: beforenetlkm
+# REQUIRE: root bootconf
+
+. /etc/rc.subr
+
+name="lkm1"
+rcvar="lkm"
+start_cmd="lkm1_start"
+stop_cmd="lkm1_stop"
+
+lkm1_start()
+{
+#              load kernel modules specified in /etc/lkm.conf if the /usr
+#              filesystem is already present with "/" or can be mounted now
+#
+       if [ -f /etc/rc.lkm ]; then
+               mount /usr >/dev/null 2>&1
+               if [ -x /usr/bin/ld ]; then
+                       lkmstage=BEFORENET
+                       set start ; . /etc/rc.lkm
+               fi
+       fi
+}
+
+lkm1_stop()
+{
+       if [ -f /etc/rc.lkm ] && [ -x /usr/bin/ld ]; then
+               lkmstage=BEFORENET
+               set stop ; . /etc/rc.lkm
+       fi
+}
+
+load_rc_config lkm
+run_rc_command "$1"
diff --git a/etc/rc.d/lkm2 b/etc/rc.d/lkm2
new file mode 100644 (file)
index 0000000..b2c3b43
--- /dev/null
@@ -0,0 +1,39 @@
+#!/bin/sh
+#
+# $NetBSD: lkm2,v 1.4 2000/09/19 13:04:38 lukem Exp $
+# $FreeBSD: src/etc/rc.d/lkm2,v 1.2 2002/06/13 22:14:36 gordon Exp $
+# $DragonFly: src/etc/rc.d/Attic/lkm2,v 1.1 2003/07/24 06:35:37 dillon Exp $
+#
+
+# PROVIDE: beforemountlkm
+# REQUIRE: syslogd
+
+. /etc/rc.subr
+
+name="lkm2"
+rcvar="lkm"
+start_cmd="lkm2_start"
+stop_cmd="lkm2_stop"
+
+#              load kernel modules specified in /etc/lkm.conf
+#
+lkm2_start()
+{
+       if [ -r /etc/rc.lkm ]; then
+               lkmstage=BEFOREMOUNT
+               set start ; . /etc/rc.lkm
+       else
+               warn "/etc/rc.lkm not found; LKMs not loaded."
+       fi
+}
+
+lkm2_stop()
+{
+       if [ -r /etc/rc.lkm ]; then
+               lkmstage=BEFOREMOUNT
+               set stop ; . /etc/rc.lkm
+       fi
+}
+
+load_rc_config lkm
+run_rc_command "$1"
diff --git a/etc/rc.d/lkm3 b/etc/rc.d/lkm3
new file mode 100644 (file)
index 0000000..394520e
--- /dev/null
@@ -0,0 +1,30 @@
+#!/bin/sh
+#
+# $NetBSD: lkm3,v 1.6 2002/03/22 04:33:58 thorpej Exp $
+# $FreeBSD: src/etc/rc.d/lkm3,v 1.2 2002/06/13 22:14:36 gordon Exp $
+# $DragonFly: src/etc/rc.d/Attic/lkm3,v 1.1 2003/07/24 06:35:37 dillon Exp $
+#
+
+# PROVIDE: aftermountlkm
+# REQUIRE: mountall
+# BEFORE:  DAEMON
+
+. /etc/rc.subr
+
+name="lkm3"
+rcvar="lkm"
+start_cmd="do_lkm3 start"
+stop_cmd="do_lkm3 stop"
+
+do_lkm3()
+{
+       #       (un)load kernel modules specified in /etc/lkm.conf
+       #
+       if [ -f /etc/rc.lkm ]; then
+               lkmstage=AFTERMOUNT
+               set $1 ; . /etc/rc.lkm
+       fi
+}
+
+load_rc_config lkm
+run_rc_command "$1"
diff --git a/etc/rc.d/local b/etc/rc.d/local
new file mode 100644 (file)
index 0000000..ebaeb71
--- /dev/null
@@ -0,0 +1,38 @@
+#!/bin/sh
+#
+# $NetBSD: local,v 1.6 2002/03/22 04:33:59 thorpej Exp $
+# $FreeBSD: src/etc/rc.d/local,v 1.4 2002/10/17 23:46:32 sobomax Exp $
+# $DragonFly: src/etc/rc.d/local,v 1.1 2003/07/24 06:35:37 dillon Exp $
+#
+
+# PROVIDE: local
+# REQUIRE: DAEMON
+# BEFORE:  LOGIN
+# KEYWORD: DragonFly FreeBSD NetBSD shutdown
+
+. /etc/rc.subr
+
+name="local"
+start_cmd="local_start"
+stop_cmd="local_stop"
+
+local_start()
+{
+       echo -n 'Starting local daemons:'
+       if [ -f /etc/rc.local ]; then
+               . /etc/rc.local
+       fi
+       echo '.'
+}
+
+local_stop()
+{
+       echo -n 'Shutting down local daemons:'
+       if [ -f /etc/rc.shutdown.local ]; then
+               . /etc/rc.shutdown.local
+       fi
+       echo '.'
+}
+
+load_rc_config $name
+run_rc_command "$1"
diff --git a/etc/rc.d/localdaemons b/etc/rc.d/localdaemons
new file mode 100644 (file)
index 0000000..d9c2c57
--- /dev/null
@@ -0,0 +1,91 @@
+#!/bin/sh
+#
+# $FreeBSD: src/etc/rc.d/localdaemons,v 1.2 2003/05/05 15:38:41 mtm Exp $
+# $DragonFly: src/etc/rc.d/localdaemons,v 1.1 2003/07/24 06:35:37 dillon Exp $
+#
+
+# PROVIDE: localdaemons
+# REQUIRE: abi
+# BEFORE:  securelevel
+# KEYWORD: DragonFly FreeBSD shutdown
+
+. /etc/rc.subr
+
+name="localdaemons"
+start_cmd="locald_start"
+stop_cmd="locald_stop"
+
+locald_start()
+{
+       # For each 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
+}
+
+locald_stop()
+{
+       echo -n 'Shutting down daemon processes:'
+
+       # For each dir in $local_startup, search for init scripts matching *.sh
+       case ${local_startup} in
+       [Nn][Oo] | '')
+               ;;
+       *)
+               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 `reverse_list ${slist}`; do
+                       if [ -x "${script}" ]; then
+                               (set -T
+                               trap 'exit 1' 2
+                               ${script} stop)
+                       fi
+               done
+               IFS="${script_save_sep}"
+               echo '.'
+               ;;
+       esac
+}
+
+load_rc_config $name
+run_rc_command "$1"
diff --git a/etc/rc.d/lpd b/etc/rc.d/lpd
new file mode 100644 (file)
index 0000000..a31a0e9
--- /dev/null
@@ -0,0 +1,29 @@
+#!/bin/sh
+#
+# $NetBSD: lpd,v 1.5 2002/03/22 04:33:59 thorpej Exp $
+# $FreeBSD: src/etc/rc.d/lpd,v 1.3 2002/09/06 16:18:05 gordon Exp $
+# $DragonFly: src/etc/rc.d/lpd,v 1.1 2003/07/24 06:35:37 dillon Exp $
+#
+
+# PROVIDE: lpd
+# REQUIRE: DAEMON
+# BEFORE:  LOGIN
+# KEYWORD: DragonFly FreeBSD NetBSD
+
+. /etc/rc.subr
+
+name="lpd"
+rcvar=`set_rcvar`
+command="/usr/sbin/${name}"
+required_files="/etc/printcap"
+
+case ${OSTYPE} in
+NetBSD)
+       pidfile="/var/run/${name}.pid"
+       ;;
+*)
+       ;;
+esac
+
+load_rc_config $name
+run_rc_command "$1"
diff --git a/etc/rc.d/mixerctl b/etc/rc.d/mixerctl
new file mode 100644 (file)
index 0000000..571bd49
--- /dev/null
@@ -0,0 +1,27 @@
+#!/bin/sh
+#
+# $NetBSD: mixerctl,v 1.2 2002/06/02 19:04:10 jmcneill Exp $
+# $DragonFly: src/etc/rc.d/Attic/mixerctl,v 1.1 2003/07/24 06:35:37 dillon Exp $
+#
+
+# PROVIDE: mixerctl
+# REQUIRE: mountcritremote
+
+. /etc/rc.subr
+
+name="mixerctl"
+start_cmd="mixerctl_start"
+stop_cmd=":"
+
+mixerctl_start()
+{
+       if [ -r /etc/mixerctl.conf ]; then
+               echo "Setting mixerctl variables..."
+               while read setting; do
+                       mixerctl -n -w $setting
+               done < /etc/mixerctl.conf
+       fi
+}
+
+load_rc_config $name
+run_rc_command "$1"
diff --git a/etc/rc.d/mopd b/etc/rc.d/mopd
new file mode 100644 (file)
index 0000000..c1f4789
--- /dev/null
@@ -0,0 +1,19 @@
+#!/bin/sh
+#
+# $NetBSD: mopd,v 1.5 2002/03/22 04:33:59 thorpej Exp $
+# $FreeBSD: src/etc/rc.d/mopd,v 1.2 2002/06/13 22:14:36 gordon Exp $
+# $DragonFly: src/etc/rc.d/Attic/mopd,v 1.1 2003/07/24 06:35:37 dillon Exp $
+#
+
+# PROVIDE: mopd
+# REQUIRE: DAEMON
+# BEFORE:  LOGIN
+
+. /etc/rc.subr
+
+name="mopd"
+rcvar=$name
+command="/usr/sbin/${name}"
+
+load_rc_config $name
+run_rc_command "$1"
diff --git a/etc/rc.d/motd b/etc/rc.d/motd
new file mode 100644 (file)
index 0000000..405a266
--- /dev/null
@@ -0,0 +1,69 @@
+#!/bin/sh
+#
+# $NetBSD: motd,v 1.5 2000/09/19 13:04:38 lukem Exp $
+# $FreeBSD: src/etc/rc.d/motd,v 1.6 2003/06/30 22:06:26 mtm Exp $
+# $DragonFly: src/etc/rc.d/motd,v 1.1 2003/07/24 06:35:37 dillon Exp $
+#
+
+# PROVIDE: motd
+# REQUIRE: mountcritremote
+# BEFORE:  LOGIN
+# KEYWORD: DragonFly FreeBSD NetBSD
+
+. /etc/rc.subr
+
+name="motd"
+rcvar="update_motd"
+start_cmd="motd_start"
+stop_cmd=":"
+
+case ${OSTYPE} in
+DragonFly)
+        PERMS="644"
+        ;;
+
+FreeBSD)
+       PERMS="644"
+       ;;
+NetBSD)
+       PERMS="664"
+       ;;
+esac
+
+motd_start()
+{
+       #       Update kernel info in /etc/motd
+       #       Must be done *before* interactive logins are possible
+       #       to prevent possible race conditions.
+       #
+       echo "Updating motd."
+       if [ ! -f /etc/motd ]; then
+               install -c -o root -g wheel -m ${PERMS} /dev/null /etc/motd
+       fi
+
+       case ${OSTYPE} in
+       DragonFly)
+               T=`mktemp -t motd`
+                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}
+                ;;
+       FreeBSD)
+               T=`mktemp -t motd`
+               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}
+               ;;
+       NetBSD)
+               T='/etc/_motd'
+               sysctl -n kern.version | while read i; do echo $i; break; done > $T
+               sed '1{/^NetBSD.*/{d;};};' < /etc/motd >> $T
+               ;;
+       esac
+       cmp -s $T /etc/motd || {
+               cp $T /etc/motd
+               chmod ${PERMS} /etc/motd
+       }
+       rm -f $T
+}
+
+load_rc_config $name
+run_rc_command "$1"
diff --git a/etc/rc.d/mountall b/etc/rc.d/mountall
new file mode 100644 (file)
index 0000000..90aca5f
--- /dev/null
@@ -0,0 +1,18 @@
+#!/bin/sh
+#
+# $NetBSD: mountall,v 1.3 2000/05/13 08:45:07 lukem Exp $
+# $FreeBSD: src/etc/rc.d/mountall,v 1.2 2002/06/13 22:14:36 gordon Exp $
+# $DragonFly: src/etc/rc.d/Attic/mountall,v 1.1 2003/07/24 06:35:37 dillon Exp $
+#
+
+# PROVIDE: mountall
+# REQUIRE: beforemountlkm
+
+. /etc/rc.subr
+
+name="mountall"
+start_cmd="echo 'Mounting all filesystems...'; mount -a"
+stop_cmd="echo 'Unmounting all filesystems...'; umount -a"
+
+load_rc_config $name
+run_rc_command "$1"
diff --git a/etc/rc.d/mountcritlocal b/etc/rc.d/mountcritlocal
new file mode 100644 (file)
index 0000000..716fa4b
--- /dev/null
@@ -0,0 +1,99 @@
+#!/bin/sh
+#
+# $NetBSD: mountcritlocal,v 1.7 2002/04/29 12:29:53 lukem Exp $
+# $FreeBSD: src/etc/rc.d/mountcritlocal,v 1.5 2003/06/01 01:43:37 gordon Exp $
+# $DragonFly: src/etc/rc.d/mountcritlocal,v 1.1 2003/07/24 06:35:37 dillon Exp $
+#
+
+# PROVIDE: mountcritlocal
+# REQUIRE: root
+# KEYWORD: DragonFly FreeBSD NetBSD
+
+. /etc/rc.subr
+
+name="mountcritlocal"
+start_cmd="mountcritlocal_start"
+stop_cmd=":"
+
+mountcritlocal_start()
+{
+       case ${OSTYPE} in
+       DragonFly)
+
+                # Set up the list of network filesystem types for which mounting
+                # should be delayed until after network initialization.
+                case ${extra_netfs_types} in
+                [Nn][Oo])
+                        ;;
+                *)
+                        netfs_types="${netfs_types} ${extra_netfs_types}"
+                        ;;
+                esac
+
+                # Mount everything except nfs filesystems.
+                mount_excludes='no'
+                for i in ${netfs_types}; do
+                        fstype=${i%:*}
+                        mount_excludes="${mount_excludes}${fstype},"
+                done
+                mount_excludes=${mount_excludes%,}
+                mount -a -t ${mount_excludes}
+                case $? in
+                0)
+                        ;;
+                *)
+                        echo 'Mounting /etc/fstab filesystems failed,' \
+                            ' startup aborted'
+                        exit 1
+                        ;;
+               esac
+                ;;
+
+       FreeBSD)
+               # Set up the list of network filesystem types for which mounting
+               # should be delayed until after network initialization.
+               case ${extra_netfs_types} in
+               [Nn][Oo])
+                       ;;
+               *)
+                       netfs_types="${netfs_types} ${extra_netfs_types}"
+                       ;;
+               esac
+
+               # Mount everything except nfs filesystems.
+               mount_excludes='no'
+               for i in ${netfs_types}; do
+                       fstype=${i%:*}
+                       mount_excludes="${mount_excludes}${fstype},"
+               done
+               mount_excludes=${mount_excludes%,}
+               mount -a -t ${mount_excludes}
+
+               case $? in
+               0)
+                       ;;
+               *)
+                       echo 'Mounting /etc/fstab filesystems failed,' \
+                           ' startup aborted'
+                       exit 1
+                       ;;
+               esac
+               ;;
+       NetBSD)
+               #       Mount critical filesystems that are `local'
+               #       (as specified in $critical_filesystems_local)
+               #       This usually includes /var.
+               #
+               mount_critical_filesystems local
+
+               #       clean up left-over files.
+               #       this could include the cleanup of lock files and /var/run, etc.
+               #
+               rm -f /etc/nologin /var/spool/lock/LCK.* /var/spool/uucp/STST/*
+               (cd /var/run && rm -rf -- *)
+               ;;
+       esac
+}
+
+load_rc_config $name
+run_rc_command "$1"
diff --git a/etc/rc.d/mountcritremote b/etc/rc.d/mountcritremote
new file mode 100644 (file)
index 0000000..936fc7a
--- /dev/null
@@ -0,0 +1,135 @@
+#!/bin/sh
+#
+# $NetBSD: mountcritremote,v 1.7 2002/04/29 12:29:53 lukem Exp $
+# $FreeBSD: src/etc/rc.d/mountcritremote,v 1.6 2003/06/01 01:43:37 gordon Exp $
+# $DragonFly: src/etc/rc.d/mountcritremote,v 1.1 2003/07/24 06:35:37 dillon Exp $
+#
+
+# PROVIDE: mountcritremote
+# REQUIRE: NETWORKING root mountcritlocal
+# KEYWORD: DragonFly FreeBSD NetBSD
+
+. /etc/rc.subr
+
+name="mountcritremote"
+stop_cmd=":"
+
+case ${OSTYPE} in
+       DragonFly)
+       start_cmd="mountcritremote_start"
+        start_precmd="mountcritremote_precmd"
+        ;;
+       FreeBSD)
+       start_cmd="mountcritremote_start"
+       start_precmd="mountcritremote_precmd"
+       ;;
+NetBSD)
+       start_cmd="mountcritremote_start"
+       ;;
+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.
+#
+mountcritremote_precmd()
+{
+       case "`mount -d -a -t nfs 2> /dev/null`" in
+       *mount_nfs*)
+               # Handle absent nfs client support
+               if ! sysctl vfs.nfs >/dev/null 2>&1; then
+                       kldload nfsclient || warn 'nfs mount ' \
+                           'requested, but no nfs client in kernel' \
+                       return 1
+               fi
+               ;;
+       esac
+       return 0
+}
+
+mountcritremote_start()
+{
+       case ${OSTYPE} in
+       DragonFly)
+               # Mount nfs filesystems.
+                #
+                echo -n 'Mounting NFS file systems:'
+                mount -a -t nfs
+                echo '.'
+                # Mount other network filesystems if present in /etc/fstab.
+                case ${extra_netfs_types} in
+                [Nn][Oo])
+                        ;;
+                *)
+                        netfs_types="${netfs_types} ${extra_netfs_types}"
+                        ;;
+                esac
+                for i in ${netfs_types}; do
+                        fstype=${i%:*}
+                        fsdecr=${i#*:}
+                        [ "${fstype}" = "nfs" ] && continue
+                        case "`mount -d -a -t ${fstype}`" in
+                        *mount_${fstype}*)
+                                echo -n "Mounting ${fsdecr} file systems:"
+                                mount -a -t ${fstype}
+                                echo '.'
+                                ;;
+                        esac
+                done
+
+               # Cleanup /var again just in case it's a network mount.
+                /etc/rc.d/cleanvar reload
+                rm -f /var/run/clean_var /var/spool/lock/clean_var
+                ;;
+
+               
+       FreeBSD)
+               # Mount nfs filesystems.
+               #
+               echo -n 'Mounting NFS file systems:'
+               mount -a -t nfs
+               echo '.'
+
+               # Mount other network filesystems if present in /etc/fstab.
+               case ${extra_netfs_types} in
+               [Nn][Oo])
+                       ;;
+               *)
+                       netfs_types="${netfs_types} ${extra_netfs_types}"
+                       ;;
+               esac
+
+               for i in ${netfs_types}; do
+                       fstype=${i%:*}
+                       fsdecr=${i#*:}
+
+                       [ "${fstype}" = "nfs" ] && continue
+
+                       case "`mount -d -a -t ${fstype}`" in
+                       *mount_${fstype}*)
+                               echo -n "Mounting ${fsdecr} file systems:"
+                               mount -a -t ${fstype}
+                               echo '.'
+                               ;;
+                       esac
+               done
+
+               # Cleanup /var again just in case it's a network mount.
+               /etc/rc.d/cleanvar reload
+               rm -f /var/run/clean_var /var/spool/lock/clean_var
+               ;;
+       NetBSD)
+               #       Mount critical filesystems that may be `remote'.
+               #       (as specified in $critical_filesystems_remote)
+               #       This usually includes /usr.
+               #
+               mount_critical_filesystems remote
+               ;;
+       esac
+}
+
+load_rc_config $name
+run_rc_command "$1"
diff --git a/etc/rc.d/mountd b/etc/rc.d/mountd
new file mode 100644 (file)
index 0000000..8d7c217
--- /dev/null
@@ -0,0 +1,73 @@
+#!/bin/sh
+#
+# $NetBSD: mountd,v 1.11 2002/01/31 01:26:06 lukem Exp $
+# $FreeBSD: src/etc/rc.d/mountd,v 1.9 2002/10/12 10:31:31 schweikh Exp $
+# $DragonFly: src/etc/rc.d/mountd,v 1.1 2003/07/24 06:35:37 dillon Exp $
+#
+
+# PROVIDE: mountd
+# REQUIRE: NETWORKING mountall beforemountlkm nfsserver rpcbind quota
+# KEYWORD: DragonFly FreeBSD NetBSD
+
+. /etc/rc.subr
+
+name="mountd"
+rcvar=`set_rcvar`
+command="/usr/sbin/${name}"
+required_files="/etc/exports"
+start_precmd="mountd_precmd"
+extra_commands="reload"
+
+mountd_precmd()
+{
+       case ${OSTYPE} in
+       DragonFly)
+               if ! checkyesno rpcbind_enable  && \
+                    ! /etc/rc.d/rpcbind forcestatus 1>/dev/null 2>&1
+                then
+                        force_depend rpcbind || return 1
+                fi
+                # mountd flags will differ depending on rc.conf settings
+                #
+                case ${nfs_server_enable} in
+                [Yy][Ee][Ss])
+                        if checkyesno weak_mountd_authentication; then
+                                mountd_flags="${mountd_flags} -n"
+                        fi
+                        ;;
+                *)
+                        if checkyesno mountd_enable; then
+                                checkyesno weak_mountd_authentication && mountd_flags="-n"
+                        fi
+                esac
+                ;;
+
+       FreeBSD)
+               if ! checkyesno rpcbind_enable  && \
+                   ! /etc/rc.d/rpcbind forcestatus 1>/dev/null 2>&1
+               then
+                       force_depend rpcbind || return 1
+               fi
+
+               # mountd flags will differ depending on rc.conf settings
+               #
+               case ${nfs_server_enable} in
+               [Yy][Ee][Ss])
+                       if checkyesno weak_mountd_authentication; then
+                               mountd_flags="${mountd_flags} -n"
+                       fi
+                       ;;
+               *)
+                       if checkyesno mountd_enable; then
+                               checkyesno weak_mountd_authentication && mountd_flags="-n"
+                       fi
+               esac
+               ;;
+       esac
+       rm -f /var/db/mountdtab
+       ( umask 022 ; > /var/db/mountdtab )
+       return 0
+}
+
+load_rc_config $name
+run_rc_command "$1"
diff --git a/etc/rc.d/moused b/etc/rc.d/moused
new file mode 100644 (file)
index 0000000..ae6c8b1
--- /dev/null
@@ -0,0 +1,49 @@
+#!/bin/sh
+#
+# $NetBSD: moused,v 1.1 2001/10/29 23:25:01 augustss Exp $
+# $FreeBSD: src/etc/rc.d/moused,v 1.3 2002/09/27 16:54:21 gordon Exp $
+# $DragonFly: src/etc/rc.d/moused,v 1.1 2003/07/24 06:35:37 dillon Exp $
+#
+
+# PROVIDE: moused
+# REQUIRE: DAEMON
+# KEYWORD: DragonFly FreeBSD NetBSD
+
+. /etc/rc.subr
+
+name=moused
+rcvar=`set_rcvar`
+command="/usr/sbin/${name}"
+
+case ${OSTYPE} in
+DragonFly)
+       start_cmd="moused_start"
+       ;;
+FreeBSD)
+       start_cmd="moused_start"
+       ;;
+esac
+
+moused_start()
+{
+       echo -n 'Starting moused:'
+       /usr/sbin/moused ${moused_flags} -p ${moused_port} -t ${moused_type}
+
+       _mousechar_arg=
+       case ${mousechar_start} in
+       [Nn][Oo] | '')
+               ;;
+       *)
+               echo -n ' mousechar_start'
+               _mousechar_arg="-M ${mousechar_start}"
+               ;;
+       esac
+
+       for ttyv in /dev/ttyv* ; do
+               vidcontrol < ${ttyv} ${_mousechar_arg} -m on
+       done
+       echo '.'
+}
+
+load_rc_config $name
+run_rc_command "$1"
diff --git a/etc/rc.d/mroute6d b/etc/rc.d/mroute6d
new file mode 100644 (file)
index 0000000..50b6cd9
--- /dev/null
@@ -0,0 +1,18 @@
+#!/bin/sh
+#
+# $FreeBSD: src/etc/rc.d/mroute6d,v 1.2 2003/01/25 23:14:08 mtm Exp $
+# $DragonFly: src/etc/rc.d/mroute6d,v 1.1 2003/07/24 06:35:37 dillon Exp $
+#
+
+# PROVIDE: mroute6d
+# REQUIRE: network_ipv6
+# KEYWORD: DragonFly FreeBSD
+
+. /etc/rc.subr
+
+name="mroute6d"
+rcvar=`set_rcvar`
+command="/usr/local/sbin/pim6dd"
+
+load_rc_config $name
+run_rc_command "$1"
diff --git a/etc/rc.d/mrouted b/etc/rc.d/mrouted
new file mode 100644 (file)
index 0000000..c85b709
--- /dev/null
@@ -0,0 +1,22 @@
+#!/bin/sh
+#
+# $NetBSD: mrouted,v 1.6 2002/03/22 04:33:59 thorpej Exp $
+# $FreeBSD: src/etc/rc.d/mrouted,v 1.5 2003/06/29 05:15:57 mtm Exp $
+# $DragonFly: src/etc/rc.d/mrouted,v 1.1 2003/07/24 06:35:37 dillon Exp $
+#
+
+# PROVIDE: mrouted
+# REQUIRE: netif routing
+# KEYWORD: DragonFly FreeBSD NetBSD
+
+. /etc/rc.subr
+
+name="mrouted"
+rcvar=`set_rcvar`
+command="/usr/sbin/${name}"
+pidfile="/var/run/${name}.pid"
+required_files="/etc/${name}.conf"
+extra_commands="reload"
+
+load_rc_config $name
+run_rc_command "$1"
diff --git a/etc/rc.d/msgs b/etc/rc.d/msgs
new file mode 100644 (file)
index 0000000..39b8e3c
--- /dev/null
@@ -0,0 +1,15 @@
+#!/bin/sh
+#
+# $FreeBSD: src/etc/rc.d/msgs,v 1.1 2002/06/13 22:14:36 gordon Exp $
+# $DragonFly: src/etc/rc.d/msgs,v 1.1 2003/07/24 06:35:37 dillon Exp $
+#
+
+# PROVIDE: msgs
+# REQUIRE: LOGIN
+# KEYWORD: DragonFly FreeBSD
+
+# 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
diff --git a/etc/rc.d/named b/etc/rc.d/named
new file mode 100644 (file)
index 0000000..bb2d18a
--- /dev/null
@@ -0,0 +1,146 @@
+#!/bin/sh
+#
+# $NetBSD: named,v 1.10 2002/03/22 04:33:59 thorpej Exp $
+# $FreeBSD: src/etc/rc.d/named,v 1.6 2003/01/12 04:53:54 mtm Exp $
+# $DragonFly: src/etc/rc.d/named,v 1.1 2003/07/24 06:35:37 dillon Exp $
+#
+
+# PROVIDE: named
+# REQUIRE: SERVERS
+# BEFORE:  DAEMON
+# KEYWORD: DragonFly FreeBSD NetBSD
+
+. /etc/rc.subr
+
+name="named"
+rcvar=`set_rcvar`
+command="/usr/sbin/${name}"
+start_precmd="named_precmd"
+required_dirs="$named_chrootdir"       # if it is set, it must exist
+extra_commands="reload"
+
+case ${OSTYPE} in
+DragonFly)
+       nuser=bind
+       ngroup=bind
+       ;;
+FreeBSD)
+       nuser=bind
+       ngroup=bind
+       ;;
+NetBSD)
+       nuser=named
+       ngroup=named
+       ;;
+esac
+
+# If running in a chroot cage, ensure that the appropriate files
+# exist inside the cage, as well as helper symlinks into the cage
+# from outside.
+#
+# As this is called after the is_running and required_dir checks
+# are made in run_rc_command(), we can safely assume ${named_chrootdir}
+# exists and named isn't running at this point (unless forcestart
+# is used).
+#
+chroot_autoupdate()
+{
+       # If the named-xfer in the system is newer than the one in the
+       # chroot directory or if it (in the chrootdir) doesn't exist
+       # copy it over
+       #
+       if [ ! -x "${named_chrootdir}/usr/libexec/named-xfer" -o \
+           "${named_chrootdir}/usr/libexec/named-xfer" -ot \
+           /usr/libexec/named-xfer ]; then
+               rm -f "${named_chrootdir}/usr/libexec/named-xfer"
+               cp -p /usr/libexec/named-xfer "${named_chrootdir}/usr/libexec"
+       fi
+
+       # Copy /dev/null over, if neccessary. Preserve everything (perms,
+       # ownership, mod times).
+       #
+       if [ ! -c "${named_chrootdir}/dev/null" ]; then
+       rm -f "${named_chrootdir}/dev/null"
+               ( cd /dev ; /bin/pax -rw -pe null "${named_chrootdir}/dev" )
+       fi
+
+       # Copy local timezone information if it's not up-to-date.
+       #
+       if [ -f /etc/localtime ]; then
+               cmp -s /etc/localtime "${named_chrootdir}/etc/localtime" || \
+               cp -p /etc/localtime "${named_chrootdir}/etc/localtime"
+       fi
+}
+
+# Make symlinks to the correct pid and ndc socket files
+#
+make_symlinks()
+{
+       ln -fs "${named_chrootdir}${named_pidfile}" ${named_pidfile}
+       ln -fs "${named_chrootdir}/var/run/ndc" /var/run/ndc
+
+}
+
+named_precmd()
+{
+       case ${OSTYPE} in
+       DragonFly)
+               ! checkyesno named_rcng && return 0
+               # Is the user using a sandbox?
+               if [ -z "$named_chrootdir" ]; then
+                       rc_flags="-u $nuser -g $ngroup $rc_flags"
+                       return 0
+               fi
+               # Do the following checks only if the user wants them done
+               checkyesno named_chroot_autoupdate && chroot_autoupdate
+               ;;
+       FreeBSD)
+               ! checkyesno named_rcng && return 0
+               # Is the user using a sandbox?
+               if [ -z "$named_chrootdir" ]; then
+                       rc_flags="-u $nuser -g $ngroup $rc_flags"
+                       return 0
+               fi
+
+               # Do the following checks only if the user wants them done
+               checkyesno named_chroot_autoupdate && chroot_autoupdate
+               ;;
+       NetBSD)
+               chroot_autoupdate
+               ;;
+       esac
+
+       case ${OSTYPE} in
+       DragonFly)      
+               # Make the symlinks only if the user wants them done.
+                checkyesno named_symlink_enable && make_symlinks
+                ;;     
+       FreeBSD)
+               # Make the symlinks only if the user wants them done.
+               checkyesno named_symlink_enable && make_symlinks
+               ;;
+       NetBSD)
+               make_symlinks
+               ;;
+       esac
+
+       #       Change run_rc_commands()'s internal copy of $named_flags
+       #
+       case ${OSTYPE} in
+       DragonFly)
+               ! checkyesno named_rcng && return
+               ;;
+       FreeBSD)
+               ! checkyesno named_rcng && return
+               ;;
+       esac
+       rc_flags="-u $nuser -g $ngroup -t ${named_chrootdir} $rc_flags"
+}
+
+load_rc_config $name
+# The following variable requires that rc.conf be loaded first
+#
+required_dirs="$named_chrootdir"       # if it is set, it must exist
+pidfile="${named_pidfile:-/var/run/${name}/pid}"
+
+run_rc_command "$1"
diff --git a/etc/rc.d/ndbootd b/etc/rc.d/ndbootd
new file mode 100644 (file)
index 0000000..ee7b0e3
--- /dev/null
@@ -0,0 +1,18 @@
+#!/bin/sh
+#
+# $DragonFly: src/etc/rc.d/Attic/ndbootd,v 1.1 2003/07/24 06:35:37 dillon Exp $
+#
+
+# PROVIDE: ndbootd
+# REQUIRE: DAEMON
+
+. /etc/rc.subr
+
+name="ndbootd"
+rcvar=$name
+command="/usr/sbin/${name}"
+pidfile="/var/run/${name}.pid"
+required_files="/etc/ethers"
+
+load_rc_config $name
+run_rc_command "$1"
diff --git a/etc/rc.d/netif b/etc/rc.d/netif
new file mode 100644 (file)
index 0000000..65b20b0
--- /dev/null
@@ -0,0 +1,167 @@
+#!/bin/sh
+#
+# Copyright (c) 2003 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 PROJECT ``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 PROJECT 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: src/etc/rc.d/netif,v 1.2 2003/06/29 05:34:41 mtm Exp $
+# $DragonFly: src/etc/rc.d/netif,v 1.1 2003/07/24 06:35:37 dillon Exp $
+#
+
+# PROVIDE: netif
+# REQUIRE: atm1 ipfilter mountcritlocal pccard serial sppp sysctl tty
+# KEYWORD: DragonFly FreeBSD
+
+. /etc/rc.subr
+. /etc/network.subr
+
+name="network"
+start_cmd="network_start"
+stop_cmd="network_stop"
+cloneup_cmd="clone_up"
+clonedown_cmd="clone_down"
+extra_commands="cloneup clonedown"
+_cmdifn=
+
+network_start()
+{
+       if [ -z "$_cmdifn" ]; then
+               #
+               # We're operating as a general network start routine.
+               #
+
+               # Create cloned interfaces
+               clone_up
+
+               # Create IPv6<-->IPv4 tunnels
+               gif_up
+       fi
+
+       # Configure the interface(s).
+       network_common ifn_start verbose
+
+       # Resync ipfilter
+       /etc/rc.d/ipfilter resync
+}
+
+network_stop()
+{
+       echo -n "Stopping network:"
+
+       # Deconfigure the interface(s)
+       network_common ifn_stop
+       echo '.'
+}
+
+# network_common routine verbose
+#      Common configuration subroutine for network interfaces. This
+#      routine takes all the preparatory steps needed for configuriing
+#      an interface and then calls $routine. If $verbose is specified,
+#      it will call ifconfig(8) to show, in long format, the configured
+#      interfaces. If $verbose is not given, it will simply output the
+#      configured interface(s).
+network_common()
+{
+       _func=
+       _verbose=
+
+       if [ -z "$1" ]; then
+               err "network_common(): No function name specified."
+       else
+               _func="$1"
+       fi
+       [ -n "$2" ] && _verbose=yes
+
+       # Get a list of network interfaces. Do not include dhcp interfaces.
+       _ifn_list="`list_net_interfaces nodhcp`"
+
+       # Set the scope of the command (all interfaces or just one).
+       #
+       _cooked_list="$_ifn_list"
+       if [ -n "$_cmdifn" ]; then
+               eval _cooked_list=\"`expr "$_ifn_list" : ".*\($_cmdifn\).*"`\"
+               if [ -z "$_cooked_list" ]; then
+                       err "No such network interface: $_cmdifn"
+                       return 1
+               fi
+       fi
+
+       for ifn in ${_cooked_list}; do
+               if ${_func} ${ifn} ; then
+                       eval showstat_$ifn=1
+               else
+                       _fail="$_fail $ifn"
+               fi
+       done
+
+       # Display interfaces configured by this script
+       #
+       for ifn in ${_cooked_list}; do
+               eval showstat=\$showstat_${ifn}
+               if [ ! -z ${showstat} ]; then
+                       if [ -n "$_verbose" ]; then
+                               ifconfig ${ifn}
+                       else
+                               echo -n " ${ifn}"
+                       fi
+               fi
+       done
+       debug "The following interfaces were not configured: $_fail"
+}
+
+ifn_start()
+{
+       local ifn cfg
+       ifn="$1"
+       cfg=1
+
+       [ -z "$ifn" ] && return 1
+
+       ifscript_up ${ifn} && cfg=0
+       ifconfig_up ${ifn} && cfg=0
+       ifalias_up ${ifn} && cfg=0
+       ipx_up ${ifn} && cfg=0
+
+       return $cfg
+}
+
+ifn_stop()
+{
+       local ifn cfg
+       ifn="$1"
+       cfg=1
+
+       [ -z "$ifn" ] && return 1
+
+       ipx_down ${ifn} && cfg=0
+       ifalias_down ${ifn} && cfg=0
+       ifconfig_down ${ifn} && cfg=0
+       ifscript_down ${ifn} && cfg=0
+
+       return $cfg
+}
+
+if [ -n "$2" ]; then
+       _cmdifn="$2"
+fi
+
+load_rc_config $name
+run_rc_command "$1"
diff --git a/etc/rc.d/netoptions b/etc/rc.d/netoptions
new file mode 100644 (file)
index 0000000..bfccf6c
--- /dev/null
@@ -0,0 +1,37 @@
+#!/bin/sh
+#
+# $FreeBSD: src/etc/rc.d/netoptions,v 1.138 2003/06/29 05:09:48 mtm Exp $
+# $DragonFly: src/etc/rc.d/netoptions,v 1.1 2003/07/24 06:35:37 dillon Exp $
+#
+
+# PROVIDE: netoptions
+# REQUIRE: localdaemons
+# BEFORE:  securelevel
+# KEYWORD: DragonFly FreeBSD
+
+. /etc/rc.subr
+
+load_rc_config 'XXX'
+
+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 '.'
diff --git a/etc/rc.d/network b/etc/rc.d/network
new file mode 100644 (file)
index 0000000..9a30f24
--- /dev/null
@@ -0,0 +1,388 @@
+#!/bin/sh
+#
+# $NetBSD: network,v 1.29 2001/01/11 17:56:16 itojun Exp $
+# $FreeBSD: src/etc/rc.d/network,v 1.3 2002/08/12 10:04:32 schweikh Exp $
+# $DragonFly: src/etc/rc.d/Attic/network,v 1.1 2003/07/24 06:35:37 dillon Exp $
+
+# PROVIDE: network
+# REQUIRE: ipfilter ipsec mountcritlocal root tty sysctl
+
+. /etc/rc.subr
+
+name="network"
+start_cmd="network_start"
+stop_cmd="network_stop"
+
+network_start()
+{
+       # set hostname, turn on network
+       #
+       echo "Starting network."
+
+       # If $hostname is set, use it for my Internet name,
+       # otherwise use /etc/myname
+       #
+       if [ -z "$hostname" ] && [ -f /etc/myname ]; then
+               hostname=`cat /etc/myname`
+       fi
+       if [ -n "$hostname" ]; then
+               echo "Hostname: $hostname"
+               hostname $hostname
+       else
+               # Don't warn about it if we're going to run
+               # DHCP later, as we will probably get the
+               # hostname at that time.
+               #
+               if ! checkyesno dhclient && [ -z "`hostname`" ]; then
+                       warn "\$hostname not set."
+               fi
+       fi
+
+       # Check $domainname first, then /etc/defaultdomain,
+       # for NIS/YP domain name
+       #
+       if [ -z "$domainname" ] && [ -f /etc/defaultdomain ]; then
+               domainname=`cat /etc/defaultdomain`
+       fi
+       if [ -n "$domainname" ]; then
+               echo "NIS domainname: $domainname"
+               domainname $domainname
+       fi
+
+       # Flush all routes just to make sure it is clean
+       if checkyesno flushroutes; then
+               route -n flush
+       fi
+
+       # Set the address for the first loopback interface, so that the
+       # auto-route from a newly configured interface's address to lo0
+       # works correctly.
+       #
+       # NOTE: obscure networking problems may occur if lo0 isn't configured...
+       #
+       ifconfig lo0 inet 127.0.0.1
+
+       # According to RFC1122, 127.0.0.0/8 should not leave the node.
+       #
+       route add -inet 127.0.0.0 -netmask 0xff000000 127.0.0.1 -reject
+
+       # IPv6 routing setups, and host/router mode selection.
+       #
+       if ifconfig lo0 inet6 >/dev/null 2>&1; then
+               # We have IPv6 support in kernel.
+
+               # disallow link-local unicast dest without outgoing scope
+               # identifiers.
+               #
+               route add -inet6 fe80:: -prefixlen 10 ::1 -reject
+
+               # disallow site-local unicast dest without outgoing scope
+               # identifiers.
+               # If you configure site-locals without scope id (it is
+               # permissible config for routers that are not on scope
+               # boundary), you may want to comment the following one out.
+               #
+               if ! checkyesno ip6sitelocal; then
+                       route add -inet6 fec0:: -prefixlen 10 ::1 -reject
+               fi
+
+               # disallow "internal" addresses to appear on the wire.
+               #
+               route add -inet6 ::ffff:0.0.0.0 -prefixlen 96 ::1 -reject
+
+               # disallow packets to malicious IPv4 compatible prefix
+               #
+               route add -inet6 ::224.0.0.0 -prefixlen 100 ::1 -reject
+               route add -inet6 ::127.0.0.0 -prefixlen 104 ::1 -reject
+               route add -inet6 ::0.0.0.0 -prefixlen 104 ::1 -reject
+               route add -inet6 ::255.0.0.0 -prefixlen 104 ::1 -reject
+
+               # 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
+
+               # Completely disallow packets to IPv4 compatible prefix.
+               # This may conflict with RFC1933 under following circumstances:
+               # (1) An IPv6-only KAME node tries to originate packets to IPv4
+               #     compatible destination.  The KAME node has no IPv4
+               #     compatible support.  Under RFC1933, it should transmit
+               #     native IPv6 packets toward IPv4 compatible destination,
+               #     hoping it would reach a router that forwards the packet
+               #     toward auto-tunnel interface.
+               # (2) An IPv6-only node originates a packet to IPv4 compatible
+               #     destination.  A KAME node is acting as an IPv6 router, and
+               #     asked to forward it.
+               # Due to rare use of IPv4 compatible address, and security
+               # issues with it, we disable it by default.
+               #
+               route add -inet6 ::0.0.0.0 -prefixlen 96 ::1 -reject
+
+               sysctl net.inet6.ip6.forwarding=0 >/dev/null
+               sysctl net.inet6.ip6.accept_rtadv=0 >/dev/null
+
+               # backward compatibility
+               #
+               if [ -z "$ip6mode" ] && [ -n "$ip6forwarding" ]; then
+                       warn 'Please migrate to newer rc.conf' \
+                           '(use ip6mode, not ip6forwarding)'
+                       if checkyesno ip6forwarding; then
+                               ip6mode=router
+                       elif checkyesno rtsol; then
+                               ip6mode=autohost
+                       else
+                               ip6mode=host
+                       fi
+               fi
+
+               case $ip6mode in
+               router)
+                       echo 'IPv6 mode: router'
+                       sysctl net.inet6.ip6.forwarding=1 >/dev/null
+                       ;;
+
+               autohost)
+                       echo 'IPv6 mode: autoconfigured host'
+                       sysctl net.inet6.ip6.accept_rtadv=1 >/dev/null
+                       ;;
+
+               host)
+                       echo 'IPv6 mode: host'
+                       ;;
+
+               *)      echo 'WARNING: invalid value in ip6mode'
+                       ;;
+
+               esac
+       fi
+
+       # Configure all of the network interfaces listed in $net_interfaces;
+       # if $auto_ifconfig is YES, grab all interfaces from ifconfig.
+       # In the following, "xxN" stands in for interface names, like "le0".
+       # For any interfaces that has an $ifconfig_xxN variable associated,
+       # we do "ifconfig xxN $ifconfig_xxN".
+       # If there is no such variable, we take the contents of the file
+       # /etc/ifconfig.xxN, and run "ifconfig xxN" repeatedly, using each
+       # line of the file as the arguments for a separate "ifconfig"
+       # invocation.
+       #
+       # In order to configure an interface reasonably, you at the very least
+       # need to specify "[addr_family] [hostname]" (e.g "inet my.domain.org"),
+       # and probably a netmask (as in "netmask 0xffffffe0"). You will
+       # frequently need to specify a media type, as in "media UTP", for
+       # interface cards with multiple media connections that do not
+       # autoconfigure. See the ifconfig manual page for details.
+       #
+       # Note that /etc/ifconfig.xxN takes multiple lines.  The following
+       # configuration is possible:
+       #       inet 10.1.1.1 netmask 0xffffff00
+       #       inet 10.1.1.2 netmask 0xffffff00 alias
+       #       inet6 fec0::1 prefixlen 64 alias
+       #
+       # You can put shell script fragment into /etc/ifconfig.xxN by
+       # starting a line with "!".  Refer to ifconfig.if(5) for details.
+       #
+       if [ "$net_interfaces" != NO ]; then
+               if checkyesno auto_ifconfig; then
+                       tmp=`ifconfig -l`
+                       for cloner in `ifconfig -C 2>/dev/null`; do
+                               for int in /etc/ifconfig.${cloner}[0-9]*; do
+                                       [ ! -f $int ] && break
+                                       tmp="$tmp ${int##*.}"
+                               done
+                       done
+               else
+                       tmp="$net_interfaces"
+               fi
+               echo -n 'Configuring network interfaces:'
+               for int in $tmp; do
+                       eval args=\$ifconfig_$int
+                       if [ -n "$args" ]; then
+                               echo -n " $int"
+                               ifconfig $int $args
+                       elif [ -f /etc/ifconfig.$int ]; then
+                               echo -n " $int"
+                               while read args; do
+                                       [ -z "$args" ] && continue
+                                       case "$args" in
+                                       "#"*)
+                                               ;;
+                                       "!"*)
+                                               eval ${args#*!}
+                                               ;;
+                                       *)
+                                               ifconfig $int $args
+                                               ;;
+                                       esac
+                               done < /etc/ifconfig.$int
+                       else
+                               if ! checkyesno auto_ifconfig; then
+                                       echo
+                                       warn \
+                       "/etc/ifconfig.$int missing and ifconfig_$int not set;"
+                                       warn "interface $int not configured."
+                               fi
+                               continue
+                       fi
+                       configured_interfaces="$configured_interfaces $int"
+               done
+               echo "."
+       fi
+
+       # Check $defaultroute, then /etc/mygate, for the name of my gateway
+       # host. That name must be in /etc/hosts.
+       #
+       if [ -z "$defaultroute" ] && [ -f /etc/mygate ]; then
+               defaultroute=`cat /etc/mygate`
+       fi
+       if [ -n "$defaultroute" ]; then
+               route add default $defaultroute
+       fi
+
+       # Check if each configured interface xxN has an $ifaliases_xxN variable
+       # associated, then configure additional IP addresses for that interface.
+       # The variable contains a list of "address netmask" pairs, with
+       # "netmask" set to "-" if the interface default netmask is to be used.
+       #
+       # Note that $ifaliases_xxN works only with certain configurations and
+       # considered not recommended.  Use /etc/ifconfig.xxN if possible.
+       #
+       #
+       if [ -n "$configured_interfaces" ]; then
+               echo "Adding interface aliases:"
+               done_aliases_message=yes
+       fi
+       for int in $configured_interfaces; do
+               eval args=\$ifaliases_$int
+               if [ -n "$args" ]; then
+                       set -- $args
+                       while [ $# -ge 2 ]; do
+                               addr=$1 ; net=$2 ; shift 2
+                               if [ "$net" = "-" ]; then
+                                       # for compatibility only, obsolete
+                                       ifconfig $int inet alias $addr
+                               else
+                                       ifconfig $int inet alias $addr \
+                                           netmask $net
+                               fi
+                               # Use loopback, not the wire
+                               route add $addr 127.0.0.1
+                       done
+               fi
+       done
+
+       # /etc/ifaliases, if it exists, contains the names of additional IP
+       # addresses for each interface. It is formatted as a series of lines
+       # that contain
+       #       address interface netmask
+       #
+       # Note that /etc/ifaliases works only with certain cases only and its
+       # use is not recommended.  Use /etc/ifconfig.xxN instead.
+       #
+       #
+       if [ -f /etc/ifaliases ]; then
+               if [ "$done_aliases_message" != yes ]; then
+                       echo "Adding interface aliases:"
+               fi
+               while read addr int net; do
+                       if [ -z "$net" ]; then
+                               # for compatibility only, obsolete
+                               ifconfig $int inet alias $addr
+                       else
+                               ifconfig $int inet alias $addr netmask $net
+                       fi
+                       # use loopback, not the wire
+                       route add $addr 127.0.0.1
+               done < /etc/ifaliases
+       fi
+
+       # IPv6 interface autoconfiguration.
+       #
+       if ifconfig lo0 inet6 >/dev/null 2>&1; then
+               # wait till DAD is completed. always invoke it in case
+               # if are configured manually by ifconfig
+               #
+               dadcount=`sysctl -n net.inet6.ip6.dad_count 2>/dev/null`
+               sleep $dadcount
+               sleep 1
+
+               if checkyesno rtsol; then
+                       if [ "$ip6mode" = "autohost" ]; then
+                               echo 'Sending router solicitation...'
+                               rtsol $rtsol_flags
+                       else
+                               echo
+                               warn \
+                           "ip6mode must be set to 'autohost' to use rtsol."
+                       fi
+
+                       # wait till DAD is completed, for global addresses
+                       # configured by router advert message.
+                       #
+                       sleep $dadcount
+                       sleep 1
+               fi
+       fi
+
+       # XXX this must die
+       if [ -s /etc/netstart.local ]; then
+               sh /etc/netstart.local start
+       fi
+}
+
+network_stop()
+{
+       echo "Stopping network."
+
+       # XXX this must die
+       if [ -s /etc/netstart.local ]; then
+               sh /etc/netstart.local stop
+       fi
+
+       echo "Deleting aliases."
+       if [ -f /etc/ifaliases ]; then
+               while read addr int net; do
+                       ifconfig $int inet delete $addr
+               done < /etc/ifaliases
+       fi
+
+       for int in `ifconfig -lu`; do
+               eval args=\$ifaliases_$int
+               if [ -n "$args" ]; then
+                       set -- $args
+                       while [ $# -ge 2 ]; do
+                               addr=$1 ; net=$2 ; shift 2
+                               ifconfig $int inet delete $addr
+                       done
+               fi
+       done
+
+       # down interfaces
+       #
+       echo -n 'Downing network interfaces:'
+       if [ "$net_interfaces" != NO ]; then
+               if checkyesno auto_ifconfig; then
+                       tmp=`ifconfig -l`
+               else
+                       tmp="$net_interfaces"
+               fi
+               for int in $tmp; do
+                       eval args=\$ifconfig_$int
+                       if [ -n "$args" ] || [ -f /etc/ifconfig.$int ]; then
+                               echo -n " $int"
+                               ifconfig $int down
+                       fi
+               done
+               echo "."
+       fi
+
+       # flush routes
+       #
+       route -n flush
+
+}
+
+load_rc_config $name
+run_rc_command "$1"
diff --git a/etc/rc.d/network1 b/etc/rc.d/network1
new file mode 100644 (file)
index 0000000..5a16de2
--- /dev/null
@@ -0,0 +1,227 @@
+#!/bin/sh
+#
+# $FreeBSD: src/etc/rc.d/network1,v 1.147 2003/06/06 13:00:43 mtm Exp $
+# $DragonFly: src/etc/rc.d/Attic/network1,v 1.1 2003/07/24 06:35:37 dillon Exp $
+#
+
+# PROVIDE: network1
+# REQUIRE: atm1 ipfilter mountcritlocal pccard serial sppp sysctl tty
+# KEYWORD: DragonFly FreeBSD nostart
+
+. /etc/rc.subr
+
+name="network1"
+start_cmd="network_start"
+stop_cmd="network_stop"
+
+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
+}
+
+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
+}
+
+network_start()
+{
+       # set hostname, turn on network
+       #
+       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
+
+       # Set the domainname if we're using NIS
+       #
+       case ${nisdomainname} in
+       [Nn][Oo]|'')
+               ;;
+       *)
+               domainname ${nisdomainname}
+               echo -n ' domain'
+               ;;
+       esac
+
+       echo '.'
+
+       # Attempt to create cloned interfaces.
+       for ifn in ${cloned_interfaces}; do
+               ifconfig ${ifn} create
+       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
+               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
+
+       # Display ifconfiged interfaces
+       for ifn in ${network_interfaces}; do
+               eval showstat=\$showstat_${ifn}
+               if [ ! -z ${showstat} ]; then
+                       ifconfig ${ifn}
+               fi
+       done
+
+       # Resync ipfilter
+       /etc/rc.d/ipfilter resync
+}
+
+network_stop()
+{
+       echo -n "Stopping network:"
+
+       # flush routes
+       #
+       echo -n " flush routes"
+       route -n flush
+
+       echo '.'
+}
+
+load_rc_config $name
+run_rc_command "$1"
diff --git a/etc/rc.d/network2 b/etc/rc.d/network2
new file mode 100644 (file)
index 0000000..be46ad3
--- /dev/null
@@ -0,0 +1,141 @@
+#!/bin/sh
+#
+# Configure routing and miscellaneous network tunables
+#
+# $FreeBSD: src/etc/rc.d/network2,v 1.137 2003/06/29 05:15:57 mtm Exp $
+# $DragonFly: src/etc/rc.d/Attic/network2,v 1.1 2003/07/24 06:35:37 dillon Exp $
+#
+
+# PROVIDE: network2
+# REQUIRE: netif ppp-user
+# KEYWORD: DragonFly FreeBSD nostart
+
+. /etc/rc.subr
+
+name="network2"
+start_cmd="network2_start"
+stop_cmd=":"
+
+network2_start()
+{
+       case ${defaultrouter} in
+       [Nn][Oo] | '')
+               ;;
+       *)
+               static_routes="default ${static_routes}"
+               route_default="default ${defaultrouter}"
+               ;;
+       esac
+
+       # Setup 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 '.'
+}
+
+load_rc_config $name
+run_rc_command "$1"
diff --git a/etc/rc.d/network3 b/etc/rc.d/network3
new file mode 100644 (file)
index 0000000..7c372e0
--- /dev/null
@@ -0,0 +1,37 @@
+#!/bin/sh
+#
+# $FreeBSD: src/etc/rc.d/network3,v 1.138 2003/06/29 05:15:57 mtm Exp $
+# $DragonFly: src/etc/rc.d/Attic/network3,v 1.1 2003/07/24 06:35:37 dillon Exp $
+#
+
+# PROVIDE: network3
+# REQUIRE: localdaemons
+# BEFORE:  securelevel
+# KEYWORD: DragonFly FreeBSD nostart
+
+. /etc/rc.subr
+
+load_rc_config 'XXX'
+
+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 '.'
diff --git a/etc/rc.d/network_ipv6 b/etc/rc.d/network_ipv6
new file mode 100644 (file)
index 0000000..51101c5
--- /dev/null
@@ -0,0 +1,127 @@
+#!/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: src/etc/rc.d/network_ipv6,v 1.35 2003/06/29 05:15:57 mtm Exp $
+#      From: src/etc/rc.network6,v 1.29 2002/04/06 15:15:43
+# $DragonFly: src/etc/rc.d/network_ipv6,v 1.1 2003/07/24 06:35:37 dillon Exp $
+#
+
+# PROVIDE: network_ipv6
+# REQUIRE: routing
+# KEYWORD: DragonFly FreeBSD
+
+. /etc/rc.subr
+. /etc/network.subr
+
+name="network_ipv6"
+rcvar=`set_rcvar ipv6`
+start_cmd="network_ipv6_start"
+
+network_ipv6_start()
+{
+       # 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_network_interfaces} in
+       [Aa][Uu][Tt][Oo])
+               # Get a list of network interfaces
+               ipv6_network_interfaces="`ifconfig -l`"
+               ;;
+       [Nn][Oo][Nn][Ee])
+               ipv6_network_interfaces=''
+               ;;
+       esac
+
+       if checkyesno ipv6_gateway_enable; then
+               # act as a router
+               ${SYSCTL_W} net.inet6.ip6.forwarding=1
+               ${SYSCTL_W} 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
+       else
+               # act as endhost - start with manual configuration
+               # Setup of net.inet6.ip6.accept_rtadv is done later by
+               # network6_interface_setup.
+               ${SYSCTL_W} net.inet6.ip6.forwarding=0
+       fi
+
+       if [ -n "${ipv6_network_interfaces}" ]; then
+               # Setup the 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
+
+       # Filter out interfaces on which IPv6 initialization failed.
+       if checkyesno ipv6_gateway_enable; then
+               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}
+       fi
+
+       # Setup IPv6 to IPv4 mapping
+       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
+
+       # Support for IPv4 address tacked onto an IPv6 address
+       if checkyesno ipv6_ipv4mapping; then
+               echo 'IPv4 mapped IPv6 address support=YES'
+               ${SYSCTL_W} net.inet6.ip6.v6only=0 >/dev/null
+       else
+               echo 'IPv4 mapped IPv6 address support=NO'
+               ${SYSCTL_W} net.inet6.ip6.v6only=1 >/dev/null
+       fi
+}
+
+load_rc_config $name
+run_rc_command "$1"
diff --git a/etc/rc.d/newsyslog b/etc/rc.d/newsyslog
new file mode 100644 (file)
index 0000000..8d071f0
--- /dev/null
@@ -0,0 +1,28 @@
+#!/bin/sh
+#
+# $NetBSD: newsyslog,v 1.5 2002/03/24 15:51:26 lukem Exp $
+# $FreeBSD: src/etc/rc.d/newsyslog,v 1.2 2002/06/13 22:14:36 gordon Exp $
+# $DragonFly: src/etc/rc.d/newsyslog,v 1.1 2003/07/24 06:35:37 dillon Exp $
+#
+
+# PROVIDE: newsyslog
+# REQUIRE: mountcritremote sysdb
+# BEFORE:  syslogd SERVERS
+
+. /etc/rc.subr
+
+name="newsyslog"
+rcvar=$name
+required_files="/etc/newsyslog.conf"
+start_cmd="newsyslog_start"
+stop_cmd=":"
+
+newsyslog_start()
+{
+       echo -n "Trimming log files:"
+       /usr/bin/newsyslog -s $rc_flags
+       echo " done."
+}
+
+load_rc_config $name
+run_rc_command "$1"
diff --git a/etc/rc.d/nfsclient b/etc/rc.d/nfsclient
new file mode 100644 (file)
index 0000000..96f024e
--- /dev/null
@@ -0,0 +1,62 @@
+#!/bin/sh
+#
+# $FreeBSD: src/etc/rc.d/nfsclient,v 1.3 2002/10/12 10:31:31 schweikh Exp $
+# $DragonFly: src/etc/rc.d/nfsclient,v 1.1 2003/07/24 06:35:37 dillon Exp $
+#
+
+# PROVIDE: nfsclient
+# REQUIRE: NETWORKING mountcritremote rpcbind
+# KEYWORD: DragonFly FreeBSD shutdown
+
+. /etc/rc.subr
+
+name="nfsclient"
+rcvar="nfs_client_enable"
+start_cmd="nfsclient_start"
+start_precmd="nfsclient_precmd"
+stop_cmd="unmount_all"
+
+# Load nfs module if it was not compiled into the kernel
+nfsclient_precmd()
+{
+       if ! sysctl vfs.nfs >/dev/null 2>&1; then
+               if ! kldload nfsclient; then
+                       warn 'Could not load nfs client module'
+                       return 1
+               fi
+       fi
+       return 0
+}
+
+nfsclient_start()
+{
+       #
+       # Run nfsiod and set some nfs client related sysctls
+       #
+       if [ -n "${nfs_client_flags}" ]; then
+               echo -n ' nfsiod'
+               nfsiod ${nfs_client_flags}
+       fi
+
+       if [ -n "${nfs_access_cache}" ]; then
+               echo "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
+
+       unmount_all
+}
+
+unmount_all()
+{
+       # 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
+}
+load_rc_config $name
+run_rc_command "$1"
diff --git a/etc/rc.d/nfsd b/etc/rc.d/nfsd
new file mode 100644 (file)
index 0000000..ed0c535
--- /dev/null
@@ -0,0 +1,62 @@
+#!/bin/sh
+#
+# $NetBSD: nfsd,v 1.4 2001/06/16 06:13:10 lukem Exp $
+# $FreeBSD: src/etc/rc.d/nfsd,v 1.9 2003/01/24 00:37:52 mtm Exp $
+# $DragonFly: src/etc/rc.d/nfsd,v 1.1 2003/07/24 06:35:37 dillon Exp $
+#
+
+# PROVIDE: nfsd
+# REQUIRE: mountd
+# KEYWORD: DragonFly FreeBSD NetBSD
+
+. /etc/rc.subr
+
+name="nfsd"
+rcvar=`set_rcvar nfs_server`
+command="/usr/sbin/${name}"
+
+load_rc_config $name
+case ${OSTYPE} in
+DragonFly)
+       command_args="${nfs_server_flags}"
+        start_precmd="nfsd_precmd"
+        sig_stop="USR1"
+        ;;
+
+FreeBSD)
+       command_args="${nfs_server_flags}"
+       start_precmd="nfsd_precmd"
+       sig_stop="USR1"
+       ;;
+NetBSD)
+       required_vars="mountd rpcbind"
+       start_precmd=
+       ;;
+esac
+
+nfsd_precmd()
+{
+       if ! sysctl vfs.nfsrv >/dev/null 2>&1; then
+               force_depend nfsserver || return 1
+       fi
+
+       if ! checkyesno rpcbind_enable  && \
+           ! /etc/rc.d/rpcbind forcestatus 1>/dev/null 2>&1
+       then
+               force_depend rpcbind || return 1
+       fi
+
+       if ! checkyesno mountd_enable  && \
+           ! /etc/rc.d/mountd forcestatus 1>/dev/null 2>&1
+       then
+               force_depend mountd || return 1
+       fi
+
+       if checkyesno nfs_reserved_port_only; then
+               echo 'NFS on reserved port only=YES'
+               sysctl vfs.nfsrv.nfs_privport=1 > /dev/null
+       fi
+       return 0
+}
+
+run_rc_command "$1"
diff --git a/etc/rc.d/nfslocking b/etc/rc.d/nfslocking
new file mode 100644 (file)
index 0000000..7b3d1de
--- /dev/null
@@ -0,0 +1,53 @@
+#!/bin/sh
+#
+# $NetBSD: nfslocking,v 1.6 2002/03/24 15:52:41 lukem Exp $
+# $FreeBSD: src/etc/rc.d/nfslocking,v 1.4 2003/01/20 18:57:16 mtm Exp $
+# $DragonFly: src/etc/rc.d/nfslocking,v 1.1 2003/07/24 06:35:37 dillon Exp $
+#
+
+# PROVIDE: nfslocking
+# REQUIRE: nfsserver nfsclient nfsd
+# BEFORE:  DAEMON
+# KEYWORD: DragonFly FreeBSD NetBSD
+
+. /etc/rc.subr
+
+arg=$1
+
+case ${OSTYPE} in
+DragonFly)
+       RCVAR_SERVER="nfs_server_enable"
+        RCVAR_CLIENT="nfs_client_enable"
+        RCVAR_STATD="rpc_statd_enable"
+        RCVAR_LOCKD="rpc_lockd_enable"
+        ;;
+FreeBSD)
+       RCVAR_SERVER="nfs_server_enable"
+       RCVAR_CLIENT="nfs_client_enable"
+       RCVAR_STATD="rpc_statd_enable"
+       RCVAR_LOCKD="rpc_lockd_enable"
+       ;;
+NetBSD)
+       RCVAR_SERVER="nfs_server"
+       RCVAR_CLIENT="nfs_client"
+       RCVAR_STATD="statd"
+       RCVAR_LOCKD="lockd"
+       ;;
+esac
+
+start_precmd='checkyesno ${RCVAR_SERVER} || checkyesno ${RCVAR_CLIENT} ||
+               [ -n "$rc_force" ]'
+stop_precmd=$start_precmd
+status_precmd=$start_precmd
+
+name="statd"
+rcvar=${RCVAR_STATD}
+command="/usr/sbin/rpc.${name}"
+load_rc_config $name
+run_rc_command "$arg"
+
+name="lockd"
+rcvar=${RCVAR_LOCKD}
+command="/usr/sbin/rpc.${name}"
+load_rc_config $name
+run_rc_command "$arg"
diff --git a/etc/rc.d/nfsserver b/etc/rc.d/nfsserver
new file mode 100644 (file)
index 0000000..5389cdf
--- /dev/null
@@ -0,0 +1,31 @@
+#!/bin/sh
+#
+# $FreeBSD: src/etc/rc.d/nfsserver,v 1.2 2002/10/12 10:31:31 schweikh Exp $
+# $DragonFly: src/etc/rc.d/nfsserver,v 1.1 2003/07/24 06:35:37 dillon Exp $
+#
+
+# PROVIDE: nfsserver
+# REQUIRE: NETWORKING mountcritremote
+# KEYWORD: DragonFly FreeBSD
+
+. /etc/rc.subr
+
+name="nfsserver"
+rcvar="nfs_server_enable"
+start_cmd="nfsserver_start"
+stop_cmd=":"
+
+# Load nfs modules if they were not compiled into the kernel
+nfsserver_start()
+{
+       if ! sysctl vfs.nfsrv >/dev/null 2>&1; then
+               if ! kldload nfsserver; then
+                       warn 'Could not load NFS server module'
+                       return 1
+               fi
+       fi
+       return 0
+}
+
+load_rc_config $name
+run_rc_command "$1"
diff --git a/etc/rc.d/nisdomain b/etc/rc.d/nisdomain
new file mode 100644 (file)
index 0000000..34850c7
--- /dev/null
@@ -0,0 +1,120 @@
+#!/bin/sh
+#
+# Copyright (c) 1993 - 2003 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 PROJECT 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 PROJECT 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: src/etc/rc.d/nisdomain,v 1.1 2003/04/18 17:51:54 mtm Exp $
+# $DragonFly: src/etc/rc.d/nisdomain,v 1.1 2003/07/24 06:35:37 dillon Exp $
+#
+
+# PROVIDE: nisdomain
+# REQUIRE: SERVERS rpcbind
+# BEFORE:  ypbind ypserv ypxfrd
+# KEYWORD: DragonFly FreeBSD
+
+. /etc/rc.subr
+
+name="nisdomain"
+start_cmd="nisdomain_start"
+stop_cmd=":"
+
+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
+}
+
+nisdomain_start()
+{
+       # Generate host.conf for compatibility
+       #
+       if [ -f "/etc/nsswitch.conf" ]; then
+               echo 'Generating 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 domainname if we're using NIS
+       #
+       case ${nisdomainname} in
+       [Nn][Oo]|'')
+               ;;
+       *)
+               domainname ${nisdomainname}
+               echo "Setting NIS domain: `/bin/domainname`."
+               ;;
+       esac
+}
+
+load_rc_config $name
+run_rc_command "$1"
diff --git a/etc/rc.d/ntpd b/etc/rc.d/ntpd
new file mode 100644 (file)
index 0000000..883e59d
--- /dev/null
@@ -0,0 +1,54 @@
+#!/bin/sh
+#
+# $NetBSD: ntpd,v 1.6 2002/03/22 04:33:59 thorpej Exp $
+# $FreeBSD: src/etc/rc.d/ntpd,v 1.5 2002/10/12 10:31:31 schweikh Exp $
+# $DragonFly: src/etc/rc.d/Attic/ntpd,v 1.1 2003/07/24 06:35:37 dillon Exp $
+#
+
+# PROVIDE: ntpd
+# REQUIRE: DAEMON
+# BEFORE:  LOGIN
+# KEYWORD: DragonFly FreeBSD NetBSD
+
+. /etc/rc.subr
+
+name=ntpd
+rcvar=`set_rcvar`
+command="/usr/sbin/${name}"
+pidfile="/var/run/${name}.pid"
+required_files="/etc/ntp.conf"
+
+case ${OSTYPE} in
+NetBSD)
+       start_precmd="ntpd_precmd"
+       ;;
+esac
+
+ntpd_precmd()
+{
+       if [ -z "$ntpd_chrootdir" ]; then
+               return 0;
+       fi
+
+       # If running in a chroot cage, ensure that the appropriate files
+       # exist inside the cage, as well as helper symlinks into the cage
+       # from outside.
+       #
+       # As this is called after the is_running and required_dir checks
+       # are made in run_rc_command(), we can safely assume ${ntpd_chrootdir}
+       # exists and ntpd isn't running at this point (unless forcestart
+       # is used).
+       #
+       if [ ! -c "${ntpd_chrootdir}/dev/clockctl" ]; then
+               rm -f "${ntpd_chrootdir}/dev/clockctl"
+               ( cd /dev ; /bin/pax -rw -pe clockctl "${ntpd_chrootdir}/dev" )
+       fi
+       ln -fs "${ntpd_chrootdir}/var/db/ntp.drift" /var/db/ntp.drift
+
+       #       Change run_rc_commands()'s internal copy of $ntpd_flags
+       #
+       rc_flags="-u ntpd:ntpd -i ${ntpd_chrootdir} $rc_flags"
+}
+
+load_rc_config $name
+run_rc_command "$1"
diff --git a/etc/rc.d/ntpdate b/etc/rc.d/ntpdate
new file mode 100644 (file)
index 0000000..4ee3a62
--- /dev/null
@@ -0,0 +1,49 @@
+#!/bin/sh
+#
+# $NetBSD: ntpdate,v 1.8 2002/03/22 04:16:39 lukem Exp $
+# $FreeBSD: src/etc/rc.d/ntpdate,v 1.4 2002/10/12 10:31:31 schweikh Exp $
+# $DragonFly: src/etc/rc.d/Attic/ntpdate,v 1.1 2003/07/24 06:35:37 dillon Exp $
+#
+
+# PROVIDE: ntpdate
+# REQUIRE: NETWORKING syslogd
+# KEYWORD: DragonFly FreeBSD NetBSD
+
+. /etc/rc.subr
+
+name="ntpdate"
+rcvar=`set_rcvar`
+
+case ${OSTYPE} in
+DragonFly)
+       command="/usr/sbin/${name}"
+        command_args=">/dev/null 2>&1"
+        pidfile="/var/run/${name}.pid"
+        ;;
+FreeBSD)
+       command="/usr/sbin/${name}"
+       command_args=">/dev/null 2>&1"
+       pidfile="/var/run/${name}.pid"
+       ;;
+NetBSD)
+       start_cmd="ntpdate_start"
+       stop_cmd=":"
+       ;;
+esac
+
+ntpdate_start()
+{
+       if [ -z "$ntpdate_hosts" ]; then
+               ntpdate_hosts=`awk '
+                       /^server[ \t]*127.127/      {next}
+                       /^(server|peer)/            {print $2}
+               ' </etc/ntp.conf`
+       fi
+       if [ -n "$ntpdate_hosts"  ]; then
+               echo "Setting date via ntp."
+               ntpdate $rc_flags $ntpdate_hosts
+       fi
+}
+
+load_rc_config $name
+run_rc_command "$1"
diff --git a/etc/rc.d/othermta b/etc/rc.d/othermta
new file mode 100644 (file)
index 0000000..ec490ae
--- /dev/null
@@ -0,0 +1,20 @@
+#!/bin/sh
+#
+# $FreeBSD: src/etc/rc.d/othermta,v 1.2 2002/08/09 17:45:04 gordon Exp $
+# $DragonFly: src/etc/rc.d/othermta,v 1.1 2003/07/24 06:35:37 dillon Exp $
+#
+
+# PROVIDE: mail
+# REQUIRE: LOGIN
+# KEYWORD: DragonFly FreeBSD
+
+# XXX - TEMPORARY SCRIPT UNTIL YOU WRITE YOUR OWN REPLACEMENT.
+#
+. /etc/rc.subr
+
+load_rc_config 'XXX'
+
+if [ -n "${mta_start_script}" ]; then
+       [ "${mta_start_script}" != "/etc/rc.sendmail" ] && \
+           sh ${mta_start_script} "$1"
+fi
similarity index 58%
copy from etc/rc.sysctl
copy to etc/rc.d/pccard
index 546658c..5b2eb48 100644 (file)
@@ -1,6 +1,6 @@
 #!/bin/sh
 #
-# Copyright (c) 1999  Warner Losh
+# Copyright (c) 1996  The FreeBSD Project
 # All rights reserved.
 #
 # Redistribution and use in source and binary forms, with or without
 # OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
 # SUCH DAMAGE.
 #
-# $FreeBSD: src/etc/rc.sysctl,v 1.4.4.6 2002/04/15 00:44:13 dougb Exp $
-# $DragonFly: src/etc/Attic/rc.sysctl,v 1.2 2003/06/17 04:24:45 dillon Exp $
+# $FreeBSD: src/etc/rc.d/pccard,v 1.28 2003/02/12 04:12:23 imp Exp $
+# $DragonFly: src/etc/rc.d/Attic/pccard,v 1.1 2003/07/24 06:35:37 dillon Exp $
 #
 
-#
-# Read in /etc/sysctl.conf and set things accordingly
-#
+# PROVIDE: pccard
+# REQUIRE: mountcritlocal
+# KEYWORD: DragonFly FreeBSD
+
+. /etc/rc.subr
+
+name="pccard"
+start_cmd="pccard_start"
+stop_cmd=":"
+
+pccard_start()
+{
+       if [ ! -c /dev/card0 ]; then
+               exit 0
+       fi
+       if checkyesno pccard_enable; then
+               echo -n 'Setup PC-CARD:'
 
-if [ -f /etc/sysctl.conf ]; then
-       while read var comments
-       do
-               case ${var} in
-               \#*|'')
+               case ${pccard_mem} in
+               [Dd][Ee][Ff][Aa][Uu][Ll][Tt])
+                       pccardc pccardmem 0xd0000 1>/dev/null && echo -n ' memory'
                        ;;
                *)
-                       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
+                       pccardc pccardmem ${pccard_mem} 1>/dev/null && echo -n ' memory'
                        ;;
                esac
-       done < /etc/sysctl.conf
-fi
+
+               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 '.'
+       fi
+}
+
+load_rc_config $name
+run_rc_command "$1"
diff --git a/etc/rc.d/pcvt b/etc/rc.d/pcvt
new file mode 100644 (file)
index 0000000..e3fa4d8
--- /dev/null
@@ -0,0 +1,234 @@
+#!/bin/sh -
+#
+# Copyright (c) 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: src/etc/rc.d/pcvt,v 1.3 2002/10/12 10:31:31 schweikh Exp $
+# $DragonFly: src/etc/rc.d/Attic/pcvt,v 1.1 2003/07/24 06:35:37 dillon Exp $
+#
+
+# PROVIDE: pcvt
+# REQUIRE: LOGIN
+# KEYWORD: DragonFly FreeBSD
+
+. /etc/rc.subr
+
+name="pcvt"
+start_precmd="pcvt_precmd"
+start_cmd="pcvt_start"
+
+pcvt_precmd()
+{
+       if [ -x /usr/sbin/ispcvt ]; then
+               /usr/sbin/ispcvt -d /dev/ttyv0 && return 0
+       fi
+       return 1
+}
+
+pcvt_echo()
+{
+       if checkyesno pcvt_verbose; then
+               echo $1 "$2"
+       fi
+}
+
+pcvt_start()
+{
+       # path for pcvt's EGA/VGA download fonts
+       FONTP=/usr/share/misc/pcvtfonts
+
+       if checkyesno pcvt_verbose; then
+               echo "Configuring pcvt console driver:"
+       else
+               echo "-n" "Configuring pcvt"
+       fi
+
+       # video adapter type
+
+       adapter=`/usr/sbin/scon -d /dev/ttyv0 -a`
+
+       pcvt_echo "-n" "  video adapter type is $adapter, "
+
+       # monitor type (mono/color)
+
+       monitor=`/usr/sbin/scon -d /dev/ttyv0 -m`
+
+       pcvt_echo "" "monitor type is $monitor"
+
+       # load fonts into VGA
+
+       if [ $adapter = VGA ]; then
+               pcvt_echo "-n" "  loading fonts: 8x16:0,"
+               loadfont -d /dev/ttyv0 -c0 -f $FONTP/vt220l.816
+
+               pcvt_echo "-n" "1 "
+               loadfont -d /dev/ttyv0 -c1 -f $FONTP/vt220h.816
+
+               pcvt_echo "-n" " 8x14:0,"
+               loadfont -d /dev/ttyv0 -c2 -f $FONTP/vt220l.814
+
+               pcvt_echo "-n" "1 "
+               loadfont -d /dev/ttyv0 -c3 -f $FONTP/vt220h.814
+
+               pcvt_echo "-n" " 8x10:0,"
+               loadfont -d /dev/ttyv0 -c4 -f $FONTP/vt220l.810
+
+               pcvt_echo "-n" "1 "
+               loadfont -d /dev/ttyv0 -c5 -f $FONTP/vt220h.810
+
+               pcvt_echo "-n" " 8x8:0,"
+               loadfont -d /dev/ttyv0 -c6 -f $FONTP/vt220l.808
+
+               pcvt_echo "" "1 "
+               loadfont -d /dev/ttyv0 -c7 -f $FONTP/vt220h.808
+
+       # setting screen sizes
+
+               case ${pcvt_lines} in
+               28)
+                       size=-s28
+                       pcvt_echo "" "  switching to 28 lines"
+                       ;;
+               40)
+                       size=-s40
+                       pcvt_echo "" "  switching to 40 lines"
+                       ;;
+               50)
+                       size=-s50
+                       pcvt_echo "" "  switching to 50 lines"
+                       ;;
+               *)
+                       size=-s25
+                       pcvt_echo "" "  switching to 25 lines"
+                       ;;
+               esac
+       fi
+
+       # use HP extensions to VT220 or plain VT220 ?
+
+       if checkyesno pcvt_hpext; then
+               emulation=-H
+               pcvt_echo "" "  setting emulation to VT220 with HP extensions"
+       else
+               emulation=-V
+               pcvt_echo "" "  setting emulation to VT220"
+       fi
+
+       # for all screens do
+
+       for device in /dev/ttyv*
+       do
+               # set emulation
+
+               /usr/sbin/scon -d$device $size $emulation >/dev/null 2>&1
+               if [ $? != 0 ]; then
+                       break 1
+               fi
+
+               # set cursor shape
+
+               case ${pcvt_cursorh} in
+               [Nn][Oo] | '')
+                       ;;
+               *)
+                       case ${pcvt_cursorl} in
+                       [Nn][Oo] | '')
+                               ;;
+                       *)
+                               /usr/sbin/cursor -d$device -s$pcvt_cursorh -e$pcvt_cursorl
+                               ;;
+                       esac
+                       ;;
+               esac
+
+               # on monochrome monitor, set color palette to use a higher intensity
+
+               if checkyesno pcvt_monohigh && \
+                       [ $monitor = MONO -a $adapter = VGA ]
+               then
+                       /usr/sbin/scon -d$device -p8,60,60,60
+               fi
+       done
+
+       # switc