[Midnightbsd-cvs] src: etc/rc.d: merge rc changes

laffer1 at midnightbsd.org laffer1 at midnightbsd.org
Sat Jan 17 20:07:56 EST 2009


Log Message:
-----------
merge rc changes

Modified Files:
--------------
    src/etc/rc.d:
        abi (r1.6 -> r1.7)
        accounting (r1.2 -> r1.3)
        amd (r1.5 -> r1.6)
        archdep (r1.3 -> r1.4)
        atm1 (r1.2 -> r1.3)
        bluetooth (r1.2 -> r1.3)
        cleanvar (r1.2 -> r1.3)
        dmesg (r1.2 -> r1.3)
        geli (r1.2 -> r1.3)
        hcsecd (r1.2 -> r1.3)
        hostname (r1.3 -> r1.4)
        ip6addrctl (r1.3 -> r1.4)
        ip6fw (r1.3 -> r1.4)

Removed Files:
-------------
    src/etc/rc.d:
        bootconf.sh

-------------- next part --------------
Index: dmesg
===================================================================
RCS file: /home/cvs/src/etc/rc.d/dmesg,v
retrieving revision 1.2
retrieving revision 1.3
diff -L etc/rc.d/dmesg -L etc/rc.d/dmesg -u -r1.2 -r1.3
--- etc/rc.d/dmesg
+++ etc/rc.d/dmesg
@@ -7,7 +7,7 @@
 # PROVIDE: dmesg
 # REQUIRE: mountcritremote cleanvar
 # BEFORE:  DAEMON
-# KEYWORD: Daemon nojail
+# KEYWORD: nojail
 
 . /etc/rc.subr
 
Index: abi
===================================================================
RCS file: /home/cvs/src/etc/rc.d/abi,v
retrieving revision 1.6
retrieving revision 1.7
diff -L etc/rc.d/abi -L etc/rc.d/abi -u -r1.6 -r1.7
--- etc/rc.d/abi
+++ etc/rc.d/abi
@@ -1,6 +1,6 @@
 #!/bin/sh
 #
-# $FreeBSD: src/etc/rc.d/abi,v 1.4.2.1 2006/01/17 06:37:48 dougb Exp $
+# $FreeBSD: src/etc/rc.d/abi,v 1.11 2006/12/30 22:53:19 yar Exp $
 # $MidnightBSD$
 
 # PROVIDE: abi
@@ -16,21 +16,21 @@
 sysv_start()
 {
 	echo -n ' sysvipc'
-	kldload sysvmsg >/dev/null 2>&1
-	kldload sysvsem >/dev/null 2>&1
-	kldload sysvshm >/dev/null 2>&1
+	load_kld sysvmsg
+	load_kld sysvsem
+	load_kld sysvshm
 }
 
 linux_start()
 {
+	local _tmpdir
+
 	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
+	load_kld -e 'linux(aout|elf)' linux
+	if [ -x /compat/linux/sbin/ldconfigDisabled ]; then
 		_tmpdir=`mktemp -d -t linux-ldconfig`
 		/compat/linux/sbin/ldconfig -C ${_tmpdir}/ld.so.cache
-		if ! cmp -s ${_tmpdir}/ld.so.cache /compat/linux/etc/ld.so.cache; then 
+		if ! cmp -s ${_tmpdir}/ld.so.cache /compat/linux/etc/ld.so.cache; then
 			cat ${_tmpdir}/ld.so.cache > /compat/linux/etc/ld.so.cache
 		fi
 		rm -rf ${_tmpdir}
@@ -40,7 +40,7 @@
 svr4_start()
 {
 	echo -n ' svr4'
-	kldload svr4 > /dev/null 2>&1
+	load_kld -m svr4elf svr4
 }
 
 abi_start()
Index: hostname
===================================================================
RCS file: /home/cvs/src/etc/rc.d/hostname,v
retrieving revision 1.3
retrieving revision 1.4
diff -L etc/rc.d/hostname -L etc/rc.d/hostname -u -r1.3 -r1.4
--- etc/rc.d/hostname
+++ etc/rc.d/hostname
@@ -23,7 +23,7 @@
 # OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
 # SUCH DAMAGE.
 #
-# $FreeBSD: src/etc/rc.d/hostname,v 1.8 2004/10/07 13:55:25 mtm Exp $
+# $FreeBSD: src/etc/rc.d/hostname,v 1.12 2007/04/02 22:53:07 des Exp $
 # $MidnightBSD$
 
 # PROVIDE: hostname
@@ -31,6 +31,7 @@
 # BEFORE:  netif
 
 . /etc/rc.subr
+. /etc/network.subr
 
 name="hostname"
 start_cmd="hostname_start"
@@ -58,8 +59,21 @@
 		fi
 	fi
 
-	/bin/hostname ${hostname}
-	echo "Setting hostname: `hostname`."
+	# Have we got a hostname yet?
+	#
+	if [ -z "${hostname}" ]; then
+		# Null hostname is probably OK if DHCP is in use.
+		#
+		if [ -z "`list_net_interfaces dhcp`" ]; then
+			warn "\$hostname is not set -- see ${rcvar_manpage}."
+		fi
+		return
+	fi
+
+	# All right, it is safe to invoke hostname(1) now.
+	#
+	echo "Setting hostname: ${hostname}."
+	/bin/hostname "${hostname}"
 }
 
 load_rc_config $name
Index: cleanvar
===================================================================
RCS file: /home/cvs/src/etc/rc.d/cleanvar,v
retrieving revision 1.2
retrieving revision 1.3
diff -L etc/rc.d/cleanvar -L etc/rc.d/cleanvar -u -r1.2 -r1.3
--- etc/rc.d/cleanvar
+++ etc/rc.d/cleanvar
@@ -4,7 +4,7 @@
 # $MidnightBSD$
 
 # PROVIDE: cleanvar
-# REQUIRE: mountcritlocal var
+# REQUIRE: FILESYSTEMS var
 
 . /etc/rc.subr
 
@@ -59,7 +59,7 @@
 	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;)
+		(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
Index: hcsecd
===================================================================
RCS file: /home/cvs/src/etc/rc.d/hcsecd,v
retrieving revision 1.2
retrieving revision 1.3
diff -L etc/rc.d/hcsecd -L etc/rc.d/hcsecd -u -r1.2 -r1.3
--- etc/rc.d/hcsecd
+++ etc/rc.d/hcsecd
@@ -1,7 +1,8 @@
 #!/bin/sh
 #
-# $FreeBSD: src/etc/rc.d/hcsecd,v 1.4.2.1 2005/11/23 18:03:33 emax Exp $
 # $MidnightBSD$
+# $FreeBSD: src/etc/rc.d/hcsecd,v 1.5 2006/12/31 10:37:18 yar Exp $
+#
 
 # PROVIDE: hcsecd
 # REQUIRE: DAEMON
@@ -14,21 +15,7 @@
 command="/usr/sbin/${name}"
 pidfile="/var/run/${name}.pid"
 rcvar=`set_rcvar`
-start_precmd="hcsecd_prestart"
-
-hcsecd_prestart()
-{
-	if ! kldstat -q -m ng_btsocket ; then
-		if kldload ng_btsocket > /dev/null 2>&1 ; then
-			info 'ng_btsocket module loaded'
-		else
-			warn 'ng_btsocket module failed to load'
-			return 1
-		fi
-	fi
-
-	return 0
-}
+required_modules="ng_btsocket"
 
 load_rc_config $name
 config="${hcsecd_config:-/etc/bluetooth/${name}.conf}"
Index: atm1
===================================================================
RCS file: /home/cvs/src/etc/rc.d/atm1,v
retrieving revision 1.2
retrieving revision 1.3
diff -L etc/rc.d/atm1 -L etc/rc.d/atm1 -u -r1.2 -r1.3
--- etc/rc.d/atm1
+++ etc/rc.d/atm1
@@ -24,9 +24,8 @@
 # OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
 # SUCH DAMAGE.
 #
+# $FreeBSD: src/etc/rc.d/atm1,v 1.16 2006/12/31 10:37:18 yar Exp $
 # $MidnightBSD$
-# $FreeBSD: src/etc/rc.d/atm1,v 1.15 2004/10/07 13:55:25 mtm Exp $
-#
 
 # PROVIDE: atm1
 # REQUIRE: root
@@ -49,7 +48,7 @@
 {
 	if [ -n "${natm_interfaces}" ] ; then
 		# Load the HARP pseudo interface
-		kldstat -v | grep -q if_harp || kldload if_harp
+		load_kld if_harp || return 1
 
 		# Load all the NATM drivers that we need
 		for natm in ${natm_interfaces} ; do
@@ -59,7 +58,7 @@
 
 	# Load loadable HARP drivers
 	for dev in ${atm_load} ; do
-		kldstat -v | grep -q ${dev} || kldload ${dev}
+		load_kld ${dev} || return 1
 	done
 
 	# Locate all probed ATM adapters
Index: ip6addrctl
===================================================================
RCS file: /home/cvs/src/etc/rc.d/ip6addrctl,v
retrieving revision 1.3
retrieving revision 1.4
diff -L etc/rc.d/ip6addrctl -L etc/rc.d/ip6addrctl -u -r1.3 -r1.4
--- etc/rc.d/ip6addrctl
+++ etc/rc.d/ip6addrctl
@@ -4,7 +4,7 @@
 # $MidnightBSD$
 
 # PROVIDE: ip6addrctl
-# REQUIRE: FILESYSTEMS  netif
+# REQUIRE: FILESYSTEMS netif
 # BEFORE: network_ipv6
 # KEYWORD: nojail
 
Index: archdep
===================================================================
RCS file: /home/cvs/src/etc/rc.d/archdep,v
retrieving revision 1.3
retrieving revision 1.4
diff -L etc/rc.d/archdep -L etc/rc.d/archdep -u -r1.3 -r1.4
--- etc/rc.d/archdep
+++ etc/rc.d/archdep
@@ -1,6 +1,6 @@
 #!/bin/sh
 #
-# $FreeBSD: src/etc/rc.d/archdep,v 1.7.2.2 2006/01/17 07:12:38 dougb Exp $
+# $FreeBSD: src/etc/rc.d/archdep,v 1.14 2006/12/31 10:37:18 yar Exp $
 # $MidnightBSD$
 
 # PROVIDE: archdep
@@ -19,13 +19,13 @@
 {
 	if checkyesno ibcs2_enable; then
 		echo -n ' ibcs2'
-		kldload ibcs2 > /dev/null 2>&1
+		load_kld ibcs2
 		case ${ibcs2_loaders} in
 		[Nn][Oo])
 			;;
 		*)
 			for i in ${ibcs2_loaders}; do
-				kldload ibcs2_$i > /dev/null 2>&1
+				load_kld ibcs2_$i
 			done
 			;;
 		esac
@@ -34,6 +34,8 @@
 
 archdep_start()
 {
+	local _arch
+
 	_arch=`${SYSCTL_N} hw.machine_arch`
 	echo -n "Initial $_arch initialization:"
 	case $_arch in
Index: amd
===================================================================
RCS file: /home/cvs/src/etc/rc.d/amd,v
retrieving revision 1.5
retrieving revision 1.6
diff -L etc/rc.d/amd -L etc/rc.d/amd -u -r1.5 -r1.6
--- etc/rc.d/amd
+++ etc/rc.d/amd
@@ -47,7 +47,7 @@
 		;;
 	*)
 		rc_flags="-p ${rc_flags}"
-		command_args=" > /var/run/amd.pid 2> /dev/null"
+		command_args="> /var/run/amd.pid 2> /dev/null"
 		;;
 	esac
 	return 0
Index: accounting
===================================================================
RCS file: /home/cvs/src/etc/rc.d/accounting,v
retrieving revision 1.2
retrieving revision 1.3
diff -L etc/rc.d/accounting -L etc/rc.d/accounting -u -r1.2 -r1.3
--- etc/rc.d/accounting
+++ etc/rc.d/accounting
@@ -20,6 +20,8 @@
 
 accounting_start()
 {
+	local _dir
+
 	_dir=`dirname "$accounting_file"`
 	if [ ! -d `dirname "$_dir"` ]; then
 		if ! mkdir -p "$_dir"; then
Index: ip6fw
===================================================================
RCS file: /home/cvs/src/etc/rc.d/ip6fw,v
retrieving revision 1.3
retrieving revision 1.4
diff -L etc/rc.d/ip6fw -L etc/rc.d/ip6fw -u -r1.3 -r1.4
--- etc/rc.d/ip6fw
+++ etc/rc.d/ip6fw
@@ -1,6 +1,6 @@
 #!/bin/sh
 #
-# $FreeBSD: src/etc/rc.d/ip6fw,v 1.6 2004/10/07 13:55:26 mtm Exp $
+# $FreeBSD: src/etc/rc.d/ip6fw,v 1.9 2007/04/02 15:38:53 mtm Exp $
 # $MidnightBSD$
 
 # PROVIDE: ip6fw
@@ -13,21 +13,8 @@
 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
-}
+required_modules="ipfw"
 
 ip6fw_start()
 {
@@ -41,7 +28,7 @@
 	if [ -r "${ipv6_firewall_script}" ]; then
 		/bin/sh "${ipv6_firewall_script}"
 		echo 'IPv6 Firewall rules loaded.'
-	elif [ "`ip6fw l 65535`" = "65535 deny ipv6 from any to any" ]; then
+	elif [ "`ipfw show 65535`" = "65535 deny ip from any to any" ]; then
 		warn 'IPv6 firewall rules have not been loaded. Default' \
 		    ' to DENY all access.'
 	fi
@@ -50,7 +37,7 @@
 	#
 	if checkyesno ipv6_firewall_logging; then
 		echo 'IPv6 Firewall logging=YES'
-		sysctl net.inet6.ip6.fw.verbose=1 >/dev/null
+		sysctl net.inet.ip.fw.verbose=1 >/dev/null
 	fi
 
 	# Enable the firewall
Index: geli
===================================================================
RCS file: /home/cvs/src/etc/rc.d/geli,v
retrieving revision 1.2
retrieving revision 1.3
diff -L etc/rc.d/geli -L etc/rc.d/geli -u -r1.2 -r1.3
--- etc/rc.d/geli
+++ etc/rc.d/geli
@@ -24,8 +24,9 @@
 # OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
 # SUCH DAMAGE.
 #
-# $FreeBSD: src/etc/rc.d/geli,v 1.2.2.2 2005/12/15 23:32:35 pjd Exp $
 # $MidnightBSD$
+# $FreeBSD: src/etc/rc.d/geli,v 1.4 2006/12/31 10:37:18 yar Exp $
+#
 
 # PROVIDE: disks
 # REQUIRE: initrandom
@@ -34,20 +35,15 @@
 . /etc/rc.subr
 
 name="geli"
+start_precmd='[ -n "$(geli_make_list)" ]'
 start_cmd="geli_start"
 stop_cmd="geli_stop"
+required_modules="geom_eli:g_eli"
 
 geli_start()
 {
 	devices=`geli_make_list`
 
-	# If there are no devices return before loading geom_eli.ko.
-	if [ -z "${devices}" ]; then
-		return
-	fi
-
-	kldstat -q -m g_eli || geli load || err 1 'geom_eli module failed to load.'
-
 	if [ -z "${geli_tries}" ]; then
 		if [ -n "${geli_attach_attempts}" ]; then
 			# Compatibility with rc.d/gbde.
Index: bluetooth
===================================================================
RCS file: /home/cvs/src/etc/rc.d/bluetooth,v
retrieving revision 1.2
retrieving revision 1.3
diff -L etc/rc.d/bluetooth -L etc/rc.d/bluetooth -u -r1.2 -r1.3
--- etc/rc.d/bluetooth
+++ etc/rc.d/bluetooth
@@ -24,8 +24,8 @@
 # OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
 # SUCH DAMAGE.
 #
-# $MidnightBSD$ 
-# $FreeBSD: src/etc/rc.d/bluetooth,v 1.1.2.1 2005/11/23 18:03:33 emax Exp $
+# $MidnightBSD$
+# $FreeBSD: src/etc/rc.d/bluetooth,v 1.3 2006/12/31 10:37:18 yar Exp $
 
 # PROVIDE: bluetooth
 # REQUIRE: DAEMON
@@ -37,6 +37,7 @@
 rcvar=
 start_cmd="bluetooth_start"
 stop_cmd="bluetooth_stop"
+required_modules="ng_bluetooth ng_hci ng_l2cap ng_btsocket"
 
 ##############################################################################
 # Read and parse Bluetooth device configuration file
@@ -44,6 +45,8 @@
 
 bluetooth_read_conf()
 {
+	local _err _file _line _namespace
+
 	_file=$1
 	_namespace=$2
 	_err=0
@@ -226,19 +229,15 @@
 
 bluetooth_start()
 {
-	dev=$1
+	local _file
 
-	# Automatically load modules
-	kldload ng_bluetooth > /dev/null 2>&1
-	kldload ng_hci > /dev/null 2>&1
-	kldload ng_l2cap > /dev/null 2>&1
-	kldload ng_btsocket > /dev/null 2>&1
+	dev=$1
 
 	# Try to figure out device type by looking at device name
 	case "${dev}" in
 	# sioX - serial/UART Bluetooth device
 	sio*)
-		kldload ng_h4 > /dev/null 2>&1
+		load_kld ng_h4 || return 1
 
 		hook="hook"
 
--- etc/rc.d/bootconf.sh
+++ /dev/null
@@ -1,82 +0,0 @@
-#!/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 $
-# $MidnightBSD: src/etc/rc.d/bootconf.sh,v 1.3 2007/10/26 14:12:39 laffer1 Exp $
-
-# PROVIDE: bootconf
-# REQUIRE: FILESYSTEMS
-
-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


More information about the Midnightbsd-cvs mailing list