[Midnightbsd-cvs] src: etc/rc.d: Add ftp-proxy, nscd (caching), zfs, auditd, bridge, and

laffer1 at midnightbsd.org laffer1 at midnightbsd.org
Thu Dec 4 11:15:51 EST 2008


Log Message:
-----------
Add ftp-proxy, nscd (caching), zfs, auditd, bridge, and bthidd.  Remove usbd as devd does that job now.

Modified Files:
--------------
    src/etc/rc.d:
        Makefile (r1.9 -> r1.10)
        devd (r1.2 -> r1.3)

Added Files:
-----------
    src/etc/rc.d:
        auditd (r1.1)
        bridge (r1.1)
        bthidd (r1.1)
        ftp-proxy (r1.1)
        nscd (r1.1)
        zfs (r1.1)

Removed Files:
-------------
    src/etc/rc.d:
        usbd

-------------- next part --------------
--- etc/rc.d/usbd
+++ /dev/null
@@ -1,18 +0,0 @@
-#!/bin/sh
-#
-# $FreeBSD: src/etc/rc.d/usbd,v 1.3 2004/10/07 13:55:26 mtm Exp $
-# $MidnightBSD: src/etc/rc.d/usbd,v 1.2 2006/08/28 02:28:59 laffer1 Exp $
-
-# PROVIDE: usbd
-# REQUIRE: DAEMON
-# BEFORE: LOGIN
-# KEYWORD: nojail
-
-. /etc/rc.subr
-
-name="usbd"
-rcvar=`set_rcvar`
-command="/usr/sbin/${name}"
-
-load_rc_config $name
-run_rc_command "$1"
--- /dev/null
+++ etc/rc.d/ftp-proxy
@@ -0,0 +1,16 @@
+#!/bin/sh
+#
+# $MidnightBSD: src/etc/rc.d/ftp-proxy,v 1.1 2008/12/04 16:15:50 laffer1 Exp $
+#
+
+# PROVIDE: ftp-proxy
+# REQUIRE: DAEMON pf
+
+. /etc/rc.subr
+
+name="ftpproxy"
+rcvar=`set_rcvar`
+command="/usr/sbin/ftp-proxy"
+
+load_rc_config $name
+run_rc_command "$1"
--- /dev/null
+++ etc/rc.d/bridge
@@ -0,0 +1,94 @@
+#!/bin/sh
+#
+# Copyright (c) 2006 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/bridge,v 1.2 2006/12/30 22:53:20 yar Exp $
+# $MidnightBSD: src/etc/rc.d/bridge,v 1.1 2008/12/04 16:15:50 laffer1 Exp $
+#
+
+# PROVIDE: bridge
+# REQUIRE: netif
+# KEYWORD: nojail
+
+. /etc/rc.subr
+. /etc/network.subr
+
+name="bridge"
+start_cmd="bridge_start"
+stop_cmd="bridge_stop"
+cmd=""
+
+glob_int () {
+	case "$1" in
+		$2 ) true ;;
+		* ) false ;;
+	esac
+} 
+
+bridge_test () {
+	bridge=$1
+	iface=$2
+
+	eval interfaces=\$autobridge_${bridge}
+	if [ -n "${interfaces}" ]; then
+		for i in ${interfaces}; do
+			if glob_int $iface $i ; then
+				ifconfig $bridge $cmd $iface > /dev/null 2>&1
+				return
+			fi
+		done
+	fi
+}
+
+autobridge()
+{
+	if [ -n "${autobridge_interfaces}" ]; then
+		if [ -z "$iflist" ]; then
+			# We're operating as a general network start routine.
+			iflist="`list_net_interfaces`"
+		fi
+
+		for br in ${autobridge_interfaces}; do
+			for i in $iflist; do
+				bridge_test $br $i
+			done
+		done
+	fi
+}
+
+bridge_start()
+{
+	cmd="addm"
+	autobridge
+}
+
+bridge_stop()
+{
+	cmd="deletem"
+	autobridge
+}
+
+iflist=$2
+
+load_rc_config $name
+run_rc_command "$1"
--- /dev/null
+++ etc/rc.d/zfs
@@ -0,0 +1,85 @@
+#!/bin/sh
+#
+# $MidnightBSD: src/etc/rc.d/zfs,v 1.1 2008/12/04 16:15:50 laffer1 Exp $
+#
+
+# PROVIDE: zfs
+# REQUIRE: mountcritlocal
+
+. /etc/rc.subr
+
+name="zfs"
+rcvar="zfs_enable"
+start_cmd="zfs_start"
+stop_cmd="zfs_stop"
+required_modules="zfs"
+
+zfs_start_jail()
+{
+	if [ `$SYSCTL_N security.jail.mount_allowed` -eq 1 ]; then
+		zfs mount -a
+	fi
+}
+
+zfs_start_main()
+{
+	zfs volinit
+	zfs mount -a
+	zfs share -a
+	if [ ! -r /etc/zfs/exports ]; then
+		touch /etc/zfs/exports
+	fi
+	# Enable swap on ZVOLs with property org.freebsd:swap=on.
+	zfs list -H -o org.freebsd:swap,name -t volume | \
+	while read state name; do
+		case "${state}" in
+		[oO][nN])
+			swapon /dev/zvol/${name}
+			;;
+		esac
+	done
+}
+
+zfs_start()
+{
+	if [ `$SYSCTL_N security.jail.jailed` -eq 1 ]; then
+		zfs_start_jail
+	else
+		zfs_start_main
+	fi
+}
+
+zfs_stop_jail()
+{
+	if [ `$SYSCTL_N security.jail.mount_allowed` -eq 1 ]; then
+		zfs unmount -a
+	fi
+}
+
+zfs_stop_main()
+{
+	# Disable swap on ZVOLs with property org.freebsd:swap=on.
+	zfs list -H -o org.freebsd:swap,name -t volume | \
+	while read state name; do
+		case "${state}" in
+		[oO][nN])
+			swapoff /dev/zvol/${name}
+			;;
+		esac
+	done
+	zfs unshare -a
+	zfs unmount -a
+	zfs volfini
+}
+
+zfs_stop()
+{
+	if [ `$SYSCTL_N security.jail.jailed` -eq 1 ]; then
+		zfs_stop_jail
+	else
+		zfs_stop_main
+	fi
+}
+
+load_rc_config $name
+run_rc_command "$1"
--- /dev/null
+++ etc/rc.d/bthidd
@@ -0,0 +1,33 @@
+#!/bin/sh
+#
+# $MidnightBSD: src/etc/rc.d/bthidd,v 1.1 2008/12/04 16:15:50 laffer1 Exp $
+#
+
+# PROVIDE: bthidd
+# REQUIRE: DAEMON hcsecd
+# BEFORE: LOGIN
+# KEYWORD: nojail
+
+. /etc/rc.subr
+
+name="bthidd"
+command="/usr/sbin/${name}"
+pidfile="/var/run/${name}.pid"
+rcvar=`set_rcvar`
+start_precmd="bthidd_prestart"
+
+bthidd_prestart()
+{
+	load_kld -m kbdmux kbdmux
+	load_kld -m vkbd vkbd
+	load_kld -m ng_btsocket ng_btsocket
+	return 0
+}
+
+load_rc_config $name
+config="${bthidd_config:-/etc/bluetooth/${name}.conf}"
+hids="${bthidd_hids:-/var/db/${name}.hids}"
+command_args="-c ${config} -H ${hids} -p ${pidfile}"
+required_files="${config}"
+
+run_rc_command "$1"
Index: devd
===================================================================
RCS file: /home/cvs/src/etc/rc.d/devd,v
retrieving revision 1.2
retrieving revision 1.3
diff -L etc/rc.d/devd -L etc/rc.d/devd -u -r1.2 -r1.3
--- etc/rc.d/devd
+++ etc/rc.d/devd
@@ -1,11 +1,10 @@
 #!/bin/sh
 #
-# $FreeBSD: src/etc/rc.d/devd,v 1.7.2.1 2005/12/16 01:42:54 dougb Exp $
 # $MidnightBSD$
 
 # PROVIDE: devd
-# REQUIRE: NETWORKING
-# BEFORE: mountcritremote
+# REQUIRE: netif network_ipv6
+# BEFORE: NETWORKING mountcritremote
 # KEYWORD: nojail
 
 . /etc/rc.subr
--- /dev/null
+++ etc/rc.d/nscd
@@ -0,0 +1,52 @@
+#!/bin/sh
+#
+# $MidnightBSD: src/etc/rc.d/nscd,v 1.1 2008/12/04 16:15:50 laffer1 Exp $
+#
+
+# PROVIDE: nscd
+# REQUIRE: DAEMON
+# BEFORE: LOGIN
+
+#
+# Add the following lines to /etc/rc.conf to enable nscd:
+#
+# nscd_enable="YES"
+#
+# See nscd(8) for flags
+#
+
+. /etc/rc.subr
+
+name=nscd
+rcvar=`set_rcvar`
+
+command=/usr/sbin/nscd
+extra_commands="flush"
+flush_cmd="${command} -I all"
+
+# usage: _nscd_set_option <option name> <default value>
+#
+_nscd_set_option() {
+	local _optname _defoptval _nscd_opt_val _cached_opt_val
+	_optname=$1
+	_defoptval=$2
+
+	_nscd_opt_val=$(eval "echo \$nscd_${_optname}")
+	_cached_opt_val=$(eval "echo \$cached_${_optname}")
+	
+	if [ -n "$_cached_opt_val" -a "$_nscd_opt_val" != "$_defoptval" ]; then
+		warn "You should use nscd_${_optname} instead of" \
+		    "cached_${_optname}"
+		setvar "nscd_${_optname}" "$_cached_opt_val"
+	else
+		setvar "nscd_${_optname}" "${_nscd_opt_val:-$_defoptval}"
+	fi
+}
+
+
+load_rc_config $name
+_nscd_set_option "enable" "NO"
+_nscd_set_option "pidfile" "/var/run/nscd.pid"
+_nscd_set_option "flags" ""
+run_rc_command "$1"
+
Index: Makefile
===================================================================
RCS file: /home/cvs/src/etc/rc.d/Makefile,v
retrieving revision 1.9
retrieving revision 1.10
diff -L etc/rc.d/Makefile -L etc/rc.d/Makefile -u -r1.9 -r1.10
--- etc/rc.d/Makefile
+++ etc/rc.d/Makefile
@@ -1,16 +1,16 @@
-# $NetBSD: Makefile,v 1.16 2001/01/14 15:37:22 minoura Exp $
-# $FreeBSD: src/etc/rc.d/Makefile,v 1.53.2.8 2006/02/12 22:13:15 flz Exp $
 # $MidnightBSD$ 
 
+.include <bsd.own.mk>
+
 FILES=	DAEMON FILESYSTEMS LOGIN NETWORKING SERVERS \
 	abi accounting addswap adjkerntz amd \
-	apm apmd archdep atm1 atm2 atm3 auto_linklocal \
-	bgfsck bluetooth bootparams bsnmpd \
+	apm apmd archdep atm1 atm2 atm3 auditd auto_linklocal \
+	bgfsck bluetooth bootparams bridge bsnmpd bthidd \
 	ccd cleanvar cleartmp cron \
 	devd devfs dhclient \
 	dmesg dumpon \
 	encswap \
-	firstboot fsck ftpd \
+	firstboot fsck ftp-proxy ftpd \
 	gbde geli geli2 \
 	hcsecd \
 	hostapd hostname \
@@ -36,16 +36,21 @@
 	serial sound sppp swap1 \
 	syscons sysctl syslogd \
 	timed tmp \
-	ugidfw usbd \
+	ugidfw \
 	var virecover \
 	watchdogd wpa_supplicant \
 	ypbind yppasswdd ypserv \
-	ypset ypupdated ypxfrd
+	ypset ypupdated ypxfrd \
+	zfs
 
-.if !defined(NO_OPENSSH)
+.if ${MK_OPENSSH} != "no"
 FILES+=	sshd
 .endif
 
+.if ${MK_NS_CACHING} != "no"
+FILES+= nscd
+.endif
+
 FILESDIR=	/etc/rc.d
 FILESMODE=	${BINMODE}
 
--- /dev/null
+++ etc/rc.d/auditd
@@ -0,0 +1,32 @@
+#!/bin/sh
+#
+# $MidnightBSD: src/etc/rc.d/auditd,v 1.1 2008/12/04 16:15:50 laffer1 Exp $
+#
+# Start up for the Audit daemon.
+#
+
+# PROVIDE: auditd
+# REQUIRE: syslogd
+# BEFORE:  DAEMON
+# KEYWORD: shutdown
+
+. /etc/rc.subr
+
+name="auditd"
+stop_cmd="auditd_stop"
+command="/usr/sbin/${name}"
+rcvar="auditd_enable"
+command_args="${auditd_flags}"
+required_files="/etc/security/audit_class /etc/security/audit_control
+		/etc/security/audit_event /etc/security/audit_user
+		/etc/security/audit_warn"
+
+auditd_stop()
+{
+
+	/usr/sbin/audit -t
+	sleep 1
+}
+
+load_rc_config $name
+run_rc_command "$1"


More information about the Midnightbsd-cvs mailing list