ports/54352: Conversion rc.d scripts to RC_NG

Scot W. Hetzel hetzel at westbend.net
Fri Jul 11 03:00:39 UTC 2003


>Number:         54352
>Category:       ports
>Synopsis:       Conversion rc.d scripts to RC_NG
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    freebsd-ports-bugs
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          change-request
>Submitter-Id:   current-users
>Arrival-Date:   Thu Jul 10 20:00:35 PDT 2003
>Closed-Date:
>Last-Modified:
>Originator:     Scot W. Hetzel
>Release:        FreeBSD 4.8-STABLE i386
>Organization:
West Bend Internet
>Environment:
System: FreeBSD WBIw009.westbend.net 4.8-STABLE FreeBSD 4.8-STABLE #6: Tue Jun 10 11:57:57 CDT 2003 root at WBIw009.westbend.net:/usr/obj/usr/src/4x/sys/GENERIC-SMP i386


>Description:
  We could have followed the way NetBSD converted their rc.d scripts.  But
  this required checking for /etc/rc.subr and then determining whether to
  use the RC_NG script or the old rc.d script.

  To support a combined RC_OLD and RC_NG rc.d script, both the port
  port maintainer and port commiter would have to ensure that the
  rc.d scripts function correctly on both RC_OLD and RC_NG systems.

  The path I finally decided on was to convert the rc.d scripts to only
  support systems that have rc.subr installed.  To make these scripts
  work on older systems, we need to create a port for rc.subr (PR 54116).

  These changes allows us to simplify the rc.d scripts, as well as provide    
  additional standard arguments (start, stop, restart, status, ...) as well
  as custom arguments.

  Attached are patches to change the rc.d scripts to RC_NG format as 
  used in FreeBSD-5.x for several ports.  These rc.d scripts depend on 
  /etc/rc.subr or using the sysutils/rc_subr port (FreeBSD < 5.x), see 
  PR 54116.

>How-To-Repeat:

>Fix:

  The Attached patch affects the following ports:

    net/freeradius
    net/openldap12
    net/openldap20
    net/openldap21
    net/openldap22
    net/radiusd-cistron
    net/samba
    net/samba-devel

  Changed Files                New Files
  -------------                ------------------
  freeradius/Makefile
  freeradius/files/radiusd.sh

  openldap12/Makefile
  openldap12/pkg-plist
  openldap12/files/slapd.sh    openldap12/files/slurpd.sh

  openldap20/Makefile
  openldap20/pkg-plist
  openldap20/files/slapd.sh
  openldap20/files/slurpd.sh

  openldap21/Makefile
  openldap21/pkg-plist
  openldap21/files/slapd.sh
  openldap21/files/slurpd.sh

  openldap22/Makefile
  openldap22/files/slapd.sh
  openldap22/files/slurpd.sh

  radiusd-cistron/Makefile
  radiusd-cistron/files/radiusd.sh.tmpl

  samba/Makefile               samba/files/nmbd.sh
  samba/pkg-plist              samba/files/smbd.sh

  samba-devel/Makefile         samba-devel/files/nmbd.sh
  samba-devel/pkg-plist        samba-devel/files/smbd.sh
  samba-devel/files/README.FreeBSD

  Removed Files
  -------------
  samba/files/samba.sh.sample
  samba-devel/files/samba.sh.sample

Index: freeradius/Makefile
===================================================================
RCS file: /home/ncvs/ports/net/freeradius/Makefile,v
retrieving revision 1.11
diff -u -r1.11 Makefile
--- freeradius/Makefile	19 Jun 2003 01:22:19 -0000	1.11
+++ freeradius/Makefile	10 Jul 2003 23:08:59 -0000
@@ -18,6 +18,7 @@
 
 LOGDIR?=	/var/log
 
+USE_RC_SUBR=	yes
 USE_GMAKE=	yes
 USE_LIBTOOL=	yes
 CONFIGURE_ARGS=	--prefix=${PREFIX} --quiet --with-logdir=${LOGDIR} \
@@ -79,11 +80,18 @@
 	       	postgresql.conf  preproxy_users proxy.conf radiusd.conf \
 	       	realms snmp.conf sql.conf users x99.conf x99passwd.sample
 
+RC_SCRIPTS_SUB=	PREFIX=${PREFIX} \
+		RC_SUBR=${RC_SUBR}
+
+post-build:
+	@${SED} ${RC_SCRIPTS_SUB:S/$/!g/:S/^/ -e s!%%/:S/=/%%!/} \
+		${FILESDIR}/radiusd.sh >${WRKDIR}/radiusd.sh
+
 post-install:
 	@${MKDIR} ${PREFIX}/etc/raddb
 .for db in ${RADDB}
 	${INSTALL_DATA} ${WRKSRC}/raddb/${db} ${PREFIX}/etc/raddb/${db}.sample
 .endfor
-	${INSTALL_SCRIPT} ${FILESDIR}/radiusd.sh ${PREFIX}/etc/rc.d/radiusd.sh
+	${INSTALL_SCRIPT} ${WRKDIR}/radiusd.sh ${PREFIX}/etc/rc.d/radiusd.sh
 
 .include <bsd.port.mk>
Index: freeradius/files/radiusd.sh
===================================================================
RCS file: /home/ncvs/ports/net/freeradius/files/radiusd.sh,v
retrieving revision 1.2
diff -u -r1.2 radiusd.sh
--- freeradius/files/radiusd.sh	19 Jun 2003 01:22:20 -0000	1.2
+++ freeradius/files/radiusd.sh	10 Jul 2003 23:09:47 -0000
@@ -1,38 +1,35 @@
 #!/bin/sh
+#
+# $FreeBSD$
+#
+
+# PROVIDE: radiusd
+# REQUIRE: LOGIN
+# KEYWORD: FreeBSD shutdown
+#
+# NOTE for FreeBSD 5.0+:
+# If you want this script to start with the base rc scripts copy
+# radiusd.sh to /etc/rc.d/radiusd
+
+prefix=%%PREFIX%%
+
+# Define the following radiusd_* variables in one of the following:
+#       /etc/rc.conf
+#       /etc/rc.conf.local
+#       /etc/rc.conf.d/radiusd
+#
+# DO NOT CHANGE THESE DEFAULT VALUES HERE
+#
+radiusd_enable="no"				# Enable radiusd (yes/no)
+#radiusd_program="${prefix}/sbin/radiusd"	# Path to radiusd program
+#radiusd_flags="-xxyzsf -l stdout"		# Additional arguments to radiusd
+
+. %%RC_SUBR%%
+
+name="radiusd"
+rcvar=${name}
+command="${prefix}/sbin/${name}"
+pidfile="/var/run/radiusd/${name}.pid"
 
-# RADIUSD_FLAGS='-xxyzsf -l stdout'
-RADIUSD_FLAGS=
-
-if [ -r /etc/defaults/rc.conf ]; then
-	. /etc/defaults/rc.conf
-	source_rc_confs
-elif [ -r /etc/rc.conf ]; then
-	. /etc/rc.conf
-fi
-
-prog=$(realpath $0) || exit 1
-dir=${prog%/*}
-PREFIX=${dir%/etc/rc.d}
-
-if [ ."$dir" = ."$prog" -o ."$PREFIX" = ."$dir" ]
-then
-	echo "$0: Cannot determine the PREFIX" >&2
-	exit 1
-fi
-
-case $1 in
-start)
-	"$PREFIX"/sbin/radiusd $RADIUSD_FLAGS && echo -n " radiusd"
-	;;
-stop)
-	if [ -f /var/run/radiusd/radiusd.pid ]; then
-		kill `cat /var/run/radiusd/radiusd.pid` && echo -n ' radiusd'
-	fi
-	;;
-*)
-	echo "Usage: `basename $0` {start|stop}" >&2
-	exit 64
-	;;
-esac
-
-exit 0
+load_rc_config $name
+run_rc_command "$1"
Index: openldap12/Makefile
===================================================================
RCS file: /home/ncvs/ports/net/openldap12/Makefile,v
retrieving revision 1.29
diff -u -r1.29 Makefile
--- openldap12/Makefile	7 Apr 2003 00:13:18 -0000	1.29
+++ openldap12/Makefile	10 Jul 2003 23:06:40 -0000
@@ -30,6 +30,7 @@
 COMMENT=	Open source LDAP client and server software
 
 USE_LIBTOOL=	yes
+USE_RC_SUBR=	yes
 
 CONFIGURE_ARGS=	--localstatedir=/var/db \
 		--enable-shared \
@@ -76,6 +77,9 @@
 		sbin/ldif2index \
 		sbin/ldif2ldbm
 
+RC_SCRIPTS_SUB=	PREFIX=${PREFIX} \
+		RC_SUBR=${RC_SUBR}
+
 .include <bsd.port.pre.mk>
 .include "${FILESDIR}/manpages"
 
@@ -83,12 +87,16 @@
 	cd ${WRKSRC} ; ${MAKE} depend
 
 post-build:
-	${SED} 's,@@PREFIX@@,${PREFIX},g' ${FILESDIR}/slapd.sh >${WRKDIR}/slapd.sh
+.for script in slapd.sh slurpd.sh
+	@${SED} ${RC_SCRIPTS_SUB:S/$/!g/:S/^/ -e s!%%/:S/=/%%!/} \
+		${FILESDIR}/${script} >${WRKDIR}/${script}
+.endfor
 
 post-install:
 .for f in ${BINS}
 	strip ${PREFIX}/${f}
 .endfor
-	${INSTALL_SCRIPT} ${WRKDIR}/slapd.sh ${PREFIX}/etc/rc.d/slapd.sh.sample
-
+.for script in slapd.sh slurpd.sh
+	${INSTALL_SCRIPT} ${WRKDIR}/${script} ${PREFIX}/etc/rc.d/${script}
+.endfor
 .include <bsd.port.post.mk>
Index: openldap12/pkg-plist
===================================================================
RCS file: /home/ncvs/ports/net/openldap12/pkg-plist,v
retrieving revision 1.8
diff -u -r1.8 pkg-plist
--- openldap12/pkg-plist	30 Oct 2000 18:38:54 -0000	1.8
+++ openldap12/pkg-plist	10 Jul 2003 21:01:37 -0000
@@ -27,7 +27,8 @@
 etc/openldap/slapd.oc.conf.default
 @exec [ ! -f %B/slapd.oc.conf ] && cp %B/%f %B/slapd.oc.conf
 @dirrm etc/openldap
-etc/rc.d/slapd.sh.sample
+etc/rc.d/slapd.sh
+etc/rc.d/slurpd.sh
 include/disptmpl.h
 include/lber.h
 include/ldap.h
Index: openldap12/files/slapd.sh
===================================================================
RCS file: /home/ncvs/ports/net/openldap12/files/slapd.sh,v
retrieving revision 1.1
diff -u -r1.1 slapd.sh
--- openldap12/files/slapd.sh	25 Sep 2000 05:43:46 -0000	1.1
+++ openldap12/files/slapd.sh	10 Jul 2003 20:53:32 -0000
@@ -1,31 +1,47 @@
 #!/bin/sh
 #
 # $FreeBSD: ports/net/openldap12/files/slapd.sh,v 1.1 2000/09/25 05:43:46 knu Exp $
+#
 
-slapd=@@PREFIX@@/libexec/slapd
-pidfile=/var/run/slapd.pid
+# PROVIDE: slapd
+# REQUIRE: DAEMON
+# KEYWORD: FreeBSD shutdown
+#
+# NOTE for FreeBSD 5.0+:
+# If you want this script to start with the base rc scripts copy
+# slapd.sh.sample to /etc/rc.d/slapd, otherwise copy it to slapd.sh
 
-case "$1" in
-start)
-    if [ -x $slapd ]; then
-	echo -n ' slapd'
-	$slapd
-    fi
-    ;;
-stop)
-    if [ -f $pidfile ]; then
-	kill `cat $pidfile`
-	telnet localhost ldap </dev/null >/dev/null 2>&1
-	echo -n ' slapd'
-	rm $pidfile
-    else
-	echo ' slapd: not running'
-    fi
-    ;;
-*)
-    echo "Usage: `basename $0` {start|stop}" >&2
-    exit 64
-    ;;
-esac
+prefix=%%PREFIX%%
 
-exit 0
+# Define the following slapd_* variables in one of the following:
+#	/etc/rc.conf
+#	/etc/rc.conf.local
+#	/etc/rc.conf.d/slapd
+#
+# DO NOT CHANGE THESE DEFAULT VALUES HERE
+#
+slapd_enable="no"				# Enable slapd (yes/no)
+#slapd_program="${prefix}/libexec/slapd"	# Path to slapd program
+slapd_flags="-u ldap -g ldap" 			# Additional arguments to slapd
+#
+# IPv4 Only
+#slapd_flags='-u ldap -g ldap -h ldap://0.0.0.0'
+#
+# IPv6 and IPv4
+#slapd_flags='-u ldap -g ldap -h "ldap://[::] ldap://0.0.0.0"'
+#
+# IPv6 Only
+#slapd_flags='-u ldap -g ldap -h ldap://[::]'
+#
+#
+
+. %%RC_SUBR%%
+
+name="slapd"
+rcvar=`set_rcvar`
+command="${prefix}/libexec/slapd"
+pidfile=/var/run/ldap/slapd.pid
+required_files="${prefix}/etc/openldap/slapd.conf ${prefix}/etc/openldap/ldap.conf"
+
+load_rc_config $name
+run_rc_command "$1"
Index: openldap12/files/slurpd.sh
===================================================================
RCS file: openldap12/files/slurpd.sh
diff -N openldap12/files/slurpd.sh
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ openldap12/files/slurpd.sh	10 Jul 2003 20:54:07 -0000
@@ -0,0 +1,37 @@
+#!/bin/sh
+#
+# $FreeBSD$
+#
+
+# PROVIDE: slurpd
+# REQUIRE: DAEMON
+# KEYWORD: FreeBSD shutdown
+#
+# NOTE for FreeBSD 5.0+:
+# If you want this script to start with the base rc scripts copy
+# slurpd.sh to /etc/rc.d/slurpd
+
+prefix=%%PREFIX%%
+
+# Define the following slurpd_* variables in one of the following:
+#	/etc/rc.conf
+#	/etc/rc.conf.local
+#	/etc/rc.conf.d/slurpd
+#
+# DO NOT CHANGE THESE DEFAULT VALUES HERE
+#
+slurpd_enable="no"				# Enable slurpd (yes/no)
+#slurpd_program="${prefix}/libexec/slapd"	# Path to slurpd program
+#slurpd_flags="" 			# Additional arguments to slurpd
+
+. %%RC_SUBR%%
+
+name="slurpd"
+rcvar=`set_rcvar`
+command="${prefix}/libexec/slurpd"
+command_args="&"
+pidfile=/var/run/ldap/slurpd.pid
+required_files="${prefix}/etc/openldap/slapd.conf ${prefix}/etc/openldap/ldap.conf"
+
+load_rc_config $name
+run_rc_command "$1"
Index: openldap20/Makefile
===================================================================
RCS file: /home/ncvs/ports/net/openldap20/Makefile,v
retrieving revision 1.70
diff -u -r1.70 Makefile
--- openldap20/Makefile	7 Jul 2003 11:51:31 -0000	1.70
+++ openldap20/Makefile	10 Jul 2003 21:44:41 -0000
@@ -46,6 +46,7 @@
 GNU_CONFIGURE=	yes
 USE_OPENSSL=	yes
 USE_REINPLACE=	yes
+USE_RC_SUBR=	yes
 CONFIGURE_TARGET=
 
 LATEST_LINK=	openldap2
@@ -111,6 +112,10 @@
 		libexec/slapd \
 		libexec/slurpd
 
+RC_SCRIPTS_SUB=	PREFIX=${PREFIX} \
+		RC_SUBR=${RC_SUBR} \
+		LDAP_RUN_DIR=${LDAP_RUN_DIR}
+
 .include <bsd.port.pre.mk>
 .include "${FILESDIR}/manpages"
 
@@ -131,16 +136,18 @@
 post-build:
 	@${REINPLACE_CMD} -e 's,${LOCALSTATEDIR}/slapd\.,${LDAP_RUN_DIR}/slapd.,g' \
 		${WRKSRC}/servers/slapd/slapd.conf.tmp
-	@${SED} -e 's,@@PREFIX@@,${PREFIX},g' -e 's,@@LDAP_RUN_DIR@@,${LDAP_RUN_DIR},g' \
-		${FILESDIR}/slapd.sh >${WRKDIR}/slapd.sh.sample
-	@${SED} -e 's,@@PREFIX@@,${PREFIX},g' -e 's,@@LDAP_RUN_DIR@@,${LDAP_RUN_DIR},g' \
-		${FILESDIR}/slurpd.sh >${WRKDIR}/slurpd.sh.sample
+.for script in slapd.sh slurpd.sh
+	@${SED} ${RC_SCRIPTS_SUB:S/$/!g/:S/^/ -e s!%%/:S/=/%%!/} \
+		${FILESDIR}/${script} >${WRKDIR}/${script}
+.endfor
 
 post-install:
 .for f in ${BINS}
 	@strip ${PREFIX}/${f}
 .endfor
-	@${INSTALL_SCRIPT} ${WRKDIR}/slapd.sh.sample ${WRKDIR}/slurpd.sh.sample ${PREFIX}/etc/rc.d
+.for script in slapd.sh slurpd.sh
+	${INSTALL_SCRIPT} ${WRKDIR}/${script} ${PREFIX}/etc/rc.d/${script}
+.endfor
 	@${CAT} ${PKGMESSAGE}
 
 .include <bsd.port.post.mk>
Index: openldap20/pkg-plist
===================================================================
RCS file: /home/ncvs/ports/net/openldap20/pkg-plist,v
retrieving revision 1.16
diff -u -r1.16 pkg-plist
--- openldap20/pkg-plist	7 Jul 2003 11:51:31 -0000	1.16
+++ openldap20/pkg-plist	10 Jul 2003 21:51:50 -0000
@@ -51,8 +51,8 @@
 @unexec /bin/rmdir %D/etc/openldap 2>/dev/null || true
 @unexec /bin/rmdir %%LOCALSTATEDIR%%/openldap-ldbm 2>/dev/null || true
 @unexec /bin/rmdir %%LOCALSTATEDIR%%/openldap-slurp 2>/dev/null || true
-etc/rc.d/slapd.sh.sample
-etc/rc.d/slurpd.sh.sample
+etc/rc.d/slapd.sh
+etc/rc.d/slurpd.sh
 include/disptmpl.h
 include/lber.h
 include/lber_types.h
Index: openldap20/files/slapd.sh
===================================================================
RCS file: /home/ncvs/ports/net/openldap20/files/slapd.sh,v
retrieving revision 1.5
diff -u -r1.5 slapd.sh
--- openldap20/files/slapd.sh	7 Jul 2003 11:51:31 -0000	1.5
+++ openldap20/files/slapd.sh	10 Jul 2003 21:45:21 -0000
@@ -1,49 +1,49 @@
 #!/bin/sh
 #
 # $FreeBSD: ports/net/openldap20/files/slapd.sh,v 1.5 2003/07/07 11:51:31 oliver Exp $
+#
 
-slapd_program=@@PREFIX@@/libexec/slapd
-
-# Uncomment one of the following:
+# PROVIDE: slapd
+# REQUIRE: DAEMON
+# KEYWORD: FreeBSD shutdown
+#
+# NOTE for FreeBSD 5.0+:
+# If you want this script to start with the base rc scripts copy
+# slapd.sh.sample to /etc/rc.d/slapd, otherwise copy it to slapd.sh
+
+prefix=%%PREFIX%%
+
+# Define the following slapd_* variables in one of the following:
+#	/etc/rc.conf
+#	/etc/rc.conf.local
+#	/etc/rc.conf.d/slapd
+#
+# DO NOT CHANGE THESE DEFAULT VALUES HERE
+#
+slapd_enable="no"				# Enable slapd (yes/no)
+#slapd_program="${prefix}/libexec/slapd"	# Path to slapd program
+slapd_flags="-u ldap -g ldap" 			# Additional arguments to slapd
 #
 # IPv4 Only
-#slapd_args='-h ldap://0.0.0.0'
+#slapd_flags='-u ldap -g ldap -h ldap://0.0.0.0'
 #
 # IPv6 and IPv4
-#slapd_ags='-h "ldap://[::] ldap://0.0.0.0"'
+#slapd_flags='-u ldap -g ldap -h "ldap://[::] ldap://0.0.0.0"'
 #
 # IPv6 Only
-#slapd_args='-h ldap://[::]'
+#slapd_flags='-u ldap -g ldap -h ldap://[::]'
 #
 # Add '-u ldap -g ldap' when you do not want to run
 # slapd as root
 #
-slapd_args=
 
-pidfile=@@LDAP_RUN_DIR@@/slapd.pid
+. %%RC_SUBR%%
 
-case "$1" in
-start)
-    if [ -x ${slapd_program} ]; then
-	echo -n ' slapd'
-	eval ${slapd_program} ${slapd_args}
-
-    fi
-    ;;
-stop)
-    if [ -f $pidfile ]; then
-	kill `cat $pidfile`
-	telnet localhost ldap </dev/null >/dev/null 2>&1
-	echo -n ' slapd'
-	rm $pidfile
-    else
-	echo ' slapd: not running'
-    fi
-    ;;
-*)
-    echo "Usage: `basename $0` {start|stop}" >&2
-    exit 64
-    ;;
-esac
+name="slapd"
+rcvar=`set_rcvar`
+command="${prefix}/libexec/slapd"
+pidfile=%%LDAP_RUN_DIR%%/slapd.pid
+required_files="${prefix}/etc/openldap/slapd.conf ${prefix}/etc/openldap/ldap.conf"
 
-exit 0
+load_rc_config $name
+run_rc_command "$1"
Index: openldap20/files/slurpd.sh
===================================================================
RCS file: /home/ncvs/ports/net/openldap20/files/slurpd.sh,v
retrieving revision 1.1
diff -u -r1.1 slurpd.sh
--- openldap20/files/slurpd.sh	7 Jul 2003 11:51:31 -0000	1.1
+++ openldap20/files/slurpd.sh	10 Jul 2003 21:45:15 -0000
@@ -1,27 +1,37 @@
 #!/bin/sh
 #
 # $FreeBSD: ports/net/openldap20/files/slurpd.sh,v 1.1 2003/07/07 11:51:31 oliver Exp $
+#
 
-slurpd_program=@@PREFIX@@/libexec/slurpd
+# PROVIDE: slurpd
+# REQUIRE: DAEMON
+# KEYWORD: FreeBSD shutdown
+#
+# NOTE for FreeBSD 5.0+:
+# If you want this script to start with the base rc scripts copy
+# slurpd.sh to /etc/rc.d/slurpd
 
-slurpd_args=
+prefix=%%PREFIX%%
 
-case "$1" in
-start)
-    if [ -x ${slurpd_program} ]; then
-	echo -n ' slurpd'
-	${slurpd_program} ${slurpd_args} 
-    fi
-    ;;
-stop)
-    if ! killall `basename ${slurpd_program}`; then
-        echo ' slurpd: not running'
-    fi
-    ;;
-*)
-    echo "Usage: `basename $0` {start|stop}" >&2
-    exit 64
-    ;;
-esac
+# Define the following slurpd_* variables in one of the following:
+#	/etc/rc.conf
+#	/etc/rc.conf.local
+#	/etc/rc.conf.d/slurpd
+#
+# DO NOT CHANGE THESE DEFAULT VALUES HERE
+#
+slurpd_enable="no"				# Enable slurpd (yes/no)
+#slurpd_program="${prefix}/libexec/slapd"	# Path to slurpd program
+#slurpd_flags="" 			# Additional arguments to slurpd
 
-exit 0
+. %%RC_SUBR%%
+
+name="slurpd"
+rcvar=`set_rcvar`
+command="${prefix}/libexec/slurpd"
+command_args="&"
+pidfile=%%LDAP_RUN_DIR%%/slurpd.pid
+required_files="${prefix}/etc/openldap/slapd.conf ${prefix}/etc/openldap/ldap.conf"
+
+load_rc_config $name
+run_rc_command "$1"
Index: openldap21/Makefile
===================================================================
RCS file: /home/ncvs/ports/net/openldap21/Makefile,v
retrieving revision 1.68
diff -u -r1.68 Makefile
--- openldap21/Makefile	7 Jul 2003 15:06:05 -0000	1.68
+++ openldap21/Makefile	10 Jul 2003 23:19:58 -0000
@@ -311,6 +311,13 @@
 PLIST_SUB+=	NO_SERVERS="@comment "
 .endif
 
+.if !defined(CLIENT_ONLY)
+USE_RC_SUBR=	YES
+
+RC_SCRIPTS_SUB=	PREFIX=${PREFIX} \  
+		RC_SUBR=${RC_SUBR}
+.endif
+
 post-patch:
 	@${CP} ${WRKSRC}/servers/slapd/slapd.conf \
 		${WRKSRC}/servers/slapd/slapd.conf.Dist
@@ -321,8 +328,10 @@
 
 post-build:
 .if !defined(CLIENT_ONLY)
-	@${SED} 's,@@PREFIX@@,${PREFIX},g' ${FILESDIR}/slapd.sh >${WRKDIR}/slapd.sh
-	@${SED} 's,@@PREFIX@@,${PREFIX},g' ${FILESDIR}/slurpd.sh >${WRKDIR}/slurpd.sh
+.for script in slapd.sh slurpd.sh
+	@${SED} ${RC_SCRIPTS_SUB:S/$/!g/:S/^/ -e s!%%/:S/=/%%!/} \
+		${FILESDIR}/${script} >${WRKDIR}/${script}
+.endfor
 .endif
 
 do-install:
@@ -341,8 +350,9 @@
 
 post-install:
 .if !defined(CLIENT_ONLY)
-	@${INSTALL_SCRIPT} ${WRKDIR}/slapd.sh ${PREFIX}/etc/rc.d/slapd.sh.sample
-	@${INSTALL_SCRIPT} ${WRKDIR}/slurpd.sh ${PREFIX}/etc/rc.d/slurpd.sh.sample
+.for script in slapd.sh slurpd.sh
+	@${INSTALL_SCRIPT} ${WRKDIR}/${script} ${PREFIX}/etc/rc.d/${script}
+.endfor
 .endif
 
 .include <bsd.port.post.mk>
Index: openldap21/pkg-plist
===================================================================
RCS file: /home/ncvs/ports/net/openldap21/pkg-plist,v
retrieving revision 1.19
diff -u -r1.19 pkg-plist
--- openldap21/pkg-plist	7 Jul 2003 15:06:05 -0000	1.19
+++ openldap21/pkg-plist	10 Jul 2003 21:50:06 -0000
@@ -47,7 +47,7 @@
 @comment -----------------------------------------
 @comment BUILD_SLURPD
 @comment -----------------------------------------
-%%NO_SERVERS%%etc/rc.d/slurpd.sh.sample
+%%NO_SERVERS%%etc/rc.d/slurpd.sh
 %%NO_SERVERS%%libexec/slurpd
 %%NO_SERVERS%%@exec [ -d /var/db/openldap-slurp ] || /bin/mkdir /var/db/openldap-slurp
 %%NO_SERVERS%%@unexec /bin/rmdir /var/db/openldap-slurp 2>/dev/null || true
@@ -55,7 +55,7 @@
 @comment -----------------------------------------
 @comment BUILD_SLAPD
 @comment -----------------------------------------
-%%NO_SERVERS%%etc/rc.d/slapd.sh.sample
+%%NO_SERVERS%%etc/rc.d/slapd.sh
 %%NO_SERVERS%%libexec/slapd
 %%NO_SERVERS%%sbin/slapadd
 %%NO_SERVERS%%sbin/slapcat
Index: openldap21/files/slapd.sh
===================================================================
RCS file: /home/ncvs/ports/net/openldap21/files/slapd.sh,v
retrieving revision 1.7
diff -u -r1.7 slapd.sh
--- openldap21/files/slapd.sh	23 May 2003 00:21:04 -0000	1.7
+++ openldap21/files/slapd.sh	10 Jul 2003 20:14:11 -0000
@@ -2,45 +2,45 @@
 #
 # $FreeBSD: ports/net/openldap21/files/slapd.sh,v 1.7 2003/05/23 00:21:04 edwin Exp $
 
-slapd_program=@@PREFIX@@/libexec/slapd
+# PROVIDE: slapd
+# REQUIRE: DAEMON
+# KEYWORD: FreeBSD shutdown
+#
+# NOTE for FreeBSD 5.0+:
+# If you want this script to start with the base rc scripts copy
+# slapd.sh.sample to /etc/rc.d/slapd, otherwise copy it to slapd.sh
+
+prefix=%%PREFIX%%
 
-# Uncomment one of the following:
+# Define the following slapd_* variables in one of the following:
+#	/etc/rc.conf
+#	/etc/rc.conf.local
+#	/etc/rc.conf.d/slapd
+#
+# DO NOT CHANGE THESE DEFAULT VALUES HERE
+#
+slapd_enable="no"				# Enable slapd (yes/no)
+#slapd_program="${prefix}/libexec/slapd"	# Path to slapd program
+slapd_flags="-u ldap -g ldap" 			# Additional arguments to slapd
 #
 # IPv4 Only
-#slapd_args='-u ldap -g ldap -h ldap://0.0.0.0'
+#slapd_flags='-u ldap -g ldap -h ldap://0.0.0.0'
 #
 # IPv6 and IPv4
-#slapd_ags='-u ldap -g ldap -h "ldap://[::] ldap://0.0.0.0"'
+#slapd_flags='-u ldap -g ldap -h "ldap://[::] ldap://0.0.0.0"'
 #
 # IPv6 Only
-#slapd_args='-u ldap -g ldap -h ldap://[::]'
+#slapd_flags='-u ldap -g ldap -h ldap://[::]'
 #
 #
-slapd_args="-u ldap -g ldap"
 
-pidfile=/var/run/ldap/slapd.pid
-
-case "$1" in
-start)
-    if [ -x $slapd ]; then
-	echo -n ' slapd'
-	eval ${slapd_program} ${slapd_args}
+. %%RC_SUBR%%
 
-    fi
-    ;;
-stop)
-    if [ -f $pidfile ]; then
-	kill `cat $pidfile`
-	echo -n ' slapd'
-	rm $pidfile
-    else
-	echo ' slapd: not running'
-    fi
-    ;;
-*)
-    echo "Usage: `basename $0` {start|stop}" >&2
-    exit 64
-    ;;
-esac
+name="slapd"
+rcvar=`set_rcvar`
+command="${prefix}/libexec/slapd"
+pidfile=/var/run/ldap/slapd.pid
+required_files="${prefix}/etc/openldap/slapd.conf ${prefix}/etc/openldap/ldap.conf"
 
-exit 0
+load_rc_config $name
+run_rc_command "$1"
Index: openldap21/files/slurpd.sh
===================================================================
RCS file: /home/ncvs/ports/net/openldap21/files/slurpd.sh,v
retrieving revision 1.2
diff -u -r1.2 slurpd.sh
--- openldap21/files/slurpd.sh	23 May 2003 00:21:04 -0000	1.2
+++ openldap21/files/slurpd.sh	10 Jul 2003 20:32:32 -0000
@@ -3,32 +3,35 @@
 # $FreeBSD: ports/net/openldap21/files/slurpd.sh,v 1.2 2003/05/23 00:21:04 edwin Exp $
 #
 
-slurpd=@@PREFIX@@/libexec/slurpd
-pidfile=/var/run/ldap/slurpd.pid
+# PROVIDE: slurpd
+# REQUIRE: DAEMON
+# KEYWORD: FreeBSD shutdown
+#
+# NOTE for FreeBSD 5.0+:
+# If you want this script to start with the base rc scripts copy
+# slurpd.sh to /etc/rc.d/slurpd
+
+prefix=%%PREFIX%%
+
+# Define the following slurpd_* variables in one of the following:
+#	/etc/rc.conf
+#	/etc/rc.conf.local
+#	/etc/rc.conf.d/slurpd
+#
+# DO NOT CHANGE THESE DEFAULT VALUES HERE
+#
+slurpd_enable="no"				# Enable slurpd (yes/no)
+#slurpd_program="${prefix}/libexec/slapd"	# Path to slurpd program
+#slurpd_flags="" 			# Additional arguments to slurpd
 
-case "$1" in
-start)
-	if [ -x $slurpd ]; then
-		echo -n ' slurpd'
-		$slurpd &
-		echo $! > $pidfile
-	fi
-	;;
-stop)
-	pids=`ps xa | awk '/slurpd/{ print $1 }'`
-	for pid in $pids; do
-		kill $pid
-		echo -n " slurpd($pid)"
-	done
-    	;;
-restart)
-	$0 stop
-	$0 start
-	;;
-*)
-	echo "Usage: `basename $0` {start|stop}" >&2
-	exit 64
-	;;
-esac
+. %%RC_SUBR%%
+
+name="slurpd"
+rcvar=`set_rcvar`
+command="${prefix}/libexec/slurpd"
+command_args="&"
+pidfile=/var/run/ldap/slurpd.pid
+required_files="${prefix}/etc/openldap/slapd.conf ${prefix}/etc/openldap/ldap.conf"
 
-exit 0
+load_rc_config $name
+run_rc_command "$1"
Index: openldap22/Makefile
===================================================================
RCS file: /home/ncvs/ports/net/openldap22/Makefile,v
retrieving revision 1.70
diff -u -r1.70 Makefile
--- openldap22/Makefile	7 Jul 2003 14:01:25 -0000	1.70
+++ openldap22/Makefile	10 Jul 2003 21:33:23 -0000
@@ -40,6 +40,7 @@
 USE_OPENSSL=		yes
 USE_REINPLACE=		yes
 USE_LIBTOOL_VER=	14
+USE_RC_SUBR=		yes
 
 PLIST=			${WRKDIR}/pkg-plist
 PKGINSTALL=		${WRKDIR}/pkg-install
@@ -55,6 +56,7 @@
 			--with-tls=openssl
 
 SED_SCRIPT=		-e 's,%%PREFIX%%,${PREFIX},g' \
+			-e 's,%%RC_SUBR%%,${RC_SUBR},g' \
 			-e 's,%%LDAP_RUN_DIR%%,${LDAP_RUN_DIR},g' \
 			-e 's,%%LOCALSTATEDIR%%,${LOCALSTATEDIR},g'
 
Index: openldap22/files/slapd.sh
===================================================================
RCS file: /home/ncvs/ports/net/openldap22/files/slapd.sh,v
retrieving revision 1.8
diff -u -r1.8 slapd.sh
--- openldap22/files/slapd.sh	2 Jul 2003 14:49:57 -0000	1.8
+++ openldap22/files/slapd.sh	10 Jul 2003 20:39:51 -0000
@@ -1,14 +1,7 @@
 #!/bin/sh
 #
 # $FreeBSD: ports/net/openldap22/files/slapd.sh,v 1.8 2003/07/02 14:49:57 kuriyama Exp $
-
-slapd_program=%%PREFIX%%/libexec/slapd
-
-slapd_pidfile=%%LDAP_RUN_DIR%%/slapd.pid
-
-slapd_enable="NO"
-
-slapd_args=
+#
 
 # Add the following lines to /etc/rc.conf to enable slapd:
 #
@@ -21,39 +14,45 @@
 # if you want to run slapd as a non-privileged user (recommended)
 #
 
-# Suck in the configuration variables.
-if [ -r /etc/defaults/rc.conf ]; then
-    . /etc/defaults/rc.conf
-    source_rc_confs
-elif [ -r /etc/rc.conf ]; then
-    . /etc/rc.conf
-fi
-
-case "$slapd_enable" in
-[Yy][Ee][Ss])
-    case "$1" in
-    start)
-        if [ -x ${slapd_program} ]; then
-            echo -n ' slapd'
-            eval ${slapd_program} ${slapd_args}
-        fi
-        ;;
-    stop)
-        if [ -f $slapd_pidfile ]; then
-            kill `cat $slapd_pidfile`
-            echo -n ' slapd'
-        else
-            echo ' slapd: not running'
-        fi
-        ;;
-    *)
-        echo "Usage: `basename $0` {start|stop}" >&2
-        exit 64
-        ;;
-    esac
-    ;;
-*)
-    ;;
-esac
+# PROVIDE: slapd
+# REQUIRE: DAEMON
+# KEYWORD: FreeBSD shutdown
+#
+# NOTE for FreeBSD 5.0+:
+# If you want this script to start with the base rc scripts copy
+# slapd.sh.sample to /etc/rc.d/slapd, otherwise copy it to slapd.sh
+
+prefix=%%PREFIX%%
+
+# Define the following slapd_* variables in one of the following:
+#	/etc/rc.conf
+#	/etc/rc.conf.local
+#	/etc/rc.conf.d/slapd
+#
+# DO NOT CHANGE THESE DEFAULT VALUES HERE
+#
+slapd_enable="no"				# Enable slapd (yes/no)
+#slapd_program="${prefix}/libexec/slapd"	# Path to slapd program
+slapd_flags="-u ldap -g ldap" 			# Additional arguments to slapd
+#
+# IPv4 Only
+#slapd_flags='-u ldap -g ldap -h ldap://0.0.0.0'
+#
+# IPv6 and IPv4
+#slapd_flags='-u ldap -g ldap -h "ldap://[::] ldap://0.0.0.0"'
+#
+# IPv6 Only
+#slapd_flags='-u ldap -g ldap -h ldap://[::]'
+#
+#
+
+. %%RC_SUBR%%
+
+name="slapd"
+rcvar=`set_rcvar`
+command="${prefix}/libexec/slapd"
+pidfile=%%LDAP_RUN_DIR%%/slapd.pid
+required_files="${prefix}/etc/openldap/slapd.conf ${prefix}/etc/openldap/ldap.conf"
 
-exit 0
+load_rc_config $name
+run_rc_command "$1"
Index: openldap22/files/slurpd.sh
===================================================================
RCS file: /home/ncvs/ports/net/openldap22/files/slurpd.sh,v
retrieving revision 1.3
diff -u -r1.3 slurpd.sh
--- openldap22/files/slurpd.sh	2 Jul 2003 14:49:57 -0000	1.3
+++ openldap22/files/slurpd.sh	10 Jul 2003 20:47:02 -0000
@@ -1,50 +1,37 @@
 #!/bin/sh
 #
 # $FreeBSD: ports/net/openldap22/files/slurpd.sh,v 1.3 2003/07/02 14:49:57 kuriyama Exp $
+#
 
-slurpd_program=%%PREFIX%%/libexec/slurpd
-
-slurpd_enable="NO"
-
-slurpd_args=
-
-# Add the following line to /etc/rc.conf to enable slurpd:
+# PROVIDE: slurpd
+# REQUIRE: DAEMON
+# KEYWORD: FreeBSD shutdown
 #
-#slurpd_enable="YES"
+# NOTE for FreeBSD 5.0+:
+# If you want this script to start with the base rc scripts copy
+# slurpd.sh to /etc/rc.d/slurpd
+
+prefix=%%PREFIX%%
+
+# Define the following slurpd_* variables in one of the following:
+#	/etc/rc.conf
+#	/etc/rc.conf.local
+#	/etc/rc.conf.d/slurpd
 #
-# See slurpd(8) for details
+# DO NOT CHANGE THESE DEFAULT VALUES HERE
 #
+slurpd_enable="no"				# Enable slurpd (yes/no)
+#slurpd_program="${prefix}/libexec/slapd"	# Path to slurpd program
+#slurpd_flags="" 			# Additional arguments to slurpd
+
+. %%RC_SUBR%%
+
+name="slurpd"
+rcvar=`set_rcvar`
+command="${prefix}/libexec/slurpd"
+command_args="&"
+pidfile=%%LDAP_RUN_DIR%%/slurpd.pid
+required_files="${prefix}/etc/openldap/slapd.conf ${prefix}/etc/openldap/ldap.conf"
 
-# Suck in the configuration variables.
-if [ -r /etc/defaults/rc.conf ]; then
-    . /etc/defaults/rc.conf
-    source_rc_confs
-elif [ -r /etc/rc.conf ]; then
-    . /etc/rc.conf
-fi
-
-case "$slurpd_enable" in
-[Yy][Ee][Ss])
-    case "$1" in
-    start)
-        if [ -x ${slurpd_program} ]; then
-            echo -n ' slurpd'
-            ${slurpd_program} ${slurpd_args} 
-        fi
-        ;;
-    stop)
-        if ! killall `basename ${slurpd_program}`; then
-            echo ' slurpd: not running'
-        fi
-        ;;
-    *)
-        echo "Usage: `basename $0` {start|stop}" >&2
-        exit 64
-        ;;
-    esac
-    ;;
-*)
-    ;;
-esac
-
-exit 0
+load_rc_config $name
+run_rc_command "$1"
Index: radiusd-cistron/Makefile
===================================================================
RCS file: /home/ncvs/ports/net/radiusd-cistron/Makefile,v
retrieving revision 1.22
diff -u -r1.22 Makefile
--- radiusd-cistron/Makefile	6 Jul 2003 03:47:10 -0000	1.22
+++ radiusd-cistron/Makefile	10 Jul 2003 22:49:51 -0000
@@ -21,13 +21,22 @@
 MAKE_ENV+=	RADIUS_DIR="${RADIUS_DIR}"
 WRKSRC=		${WRKDIR}/${PORTNAME}-${PORTVERSION}
 
+USE_RC_SUBR=	YES
+
 MAN1=		radclient.1 radlast.1 radtest.1 radwho.1 radzap.1
 MAN5=		clients.5rad naslist.5rad
 MAN8=		radiusd.8 radrelay.8 radwatch.8
 
+RC_SCRIPTS_SUB= PREFIX=${PREFIX} \
+                RC_SUBR=${RC_SUBR}
+
 do-build:
 	cd ${WRKSRC}/src && ${SETENV} ${MAKE_ENV} ${MAKE} -f ${MAKEFILE}
 
+post-build:
+	@${SED} ${RC_SCRIPTS_SUB:S/$/!g/:S/^/ -e s!%%/:S/=/%%!/} \
+		${FILESDIR}/radiusd.sh.tmpl >${WRKDIR}/radiusd.sh
+
 do-install:
 	cd ${WRKSRC}/src && ${SETENV} ${MAKE_ENV} ${MAKE} -f ${MAKEFILE} install
 	@${MKDIR} -m 700 /var/log/radacct
@@ -54,9 +63,6 @@
 	${INSTALL_MAN} ${WRKSRC}/doc/radwatch.8 ${MANPREFIX}/man/man8
 
 post-install:
-	@${SED} -e "s=!!PREFIX!!=${PREFIX}=g" ${FILESDIR}/radiusd.sh.tmpl \
-		> ${PREFIX}/etc/rc.d/radiusd.sh
-	@${CHMOD} 555 ${PREFIX}/etc/rc.d/radiusd.sh
-	@${CHOWN} root:wheel ${PREFIX}/etc/rc.d/radiusd.sh
+	$@{INSTALL_SCRIPT} ${WRKDIR}/radiusd.sh ${PREFIX}/etc/rc.d/radiusd.sh
 
 .include <bsd.port.mk>
Index: radiusd-cistron/files/radiusd.sh.tmpl
===================================================================
RCS file: /home/ncvs/ports/net/radiusd-cistron/files/radiusd.sh.tmpl,v
retrieving revision 1.1
diff -u -r1.1 radiusd.sh.tmpl
--- radiusd-cistron/files/radiusd.sh.tmpl	18 Jan 1999 03:10:33 -0000	1.1
+++ radiusd-cistron/files/radiusd.sh.tmpl	10 Jul 2003 22:54:18 -0000
@@ -1,5 +1,36 @@
 #!/bin/sh
-case "$1" in
-stop) killall radiusd;;
-*) [ -x !!PREFIX!!/sbin/radiusd ] && !!PREFIX!!/sbin/radiusd -y && echo -n ' radiusd';;
-esac
+#
+# $FreeBSD$
+#
+
+# PROVIDE: radiusd
+# REQUIRE: LOGIN
+# KEYWORD: FreeBSD shutdown
+#
+# NOTE for FreeBSD 5.0+:
+# If you want this script to start with the base rc scripts copy
+# radiusd.sh to /etc/rc.d/radiusd
+
+prefix=%%PREFIX%%
+
+# Define the following radiusd_* variables in one of the following:
+#       /etc/rc.conf
+#       /etc/rc.conf.local
+#       /etc/rc.conf.d/radiusd
+#
+# DO NOT CHANGE THESE DEFAULT VALUES HERE
+#
+radiusd_enable="no"				# Enable radiusd (yes/no)
+#radiusd_program="${prefix}/sbin/radiusd"	# Path to radiusd program
+#radiusd_flags=""				# Additional arguments to radiusd
+
+. %%RC_SUBR%%
+
+name="radiusd"
+rcvar=${name}
+command="${prefix}/sbin/${name}"
+command_args="-y"
+pidfile="/var/run/${name}.pid"
+
+load_rc_config $name
+run_rc_command "$1"
Index: samba/Makefile
===================================================================
RCS file: /home/ncvs/ports/net/samba/Makefile,v
retrieving revision 1.123
diff -u -r1.123 Makefile
--- samba/Makefile	17 Apr 2003 14:21:54 -0000	1.123
+++ samba/Makefile	9 Jul 2003 20:29:09 -0000
@@ -21,6 +21,7 @@
 USE_GMAKE=	YES
 USE_LIBTOOL=	YES
 USE_AUTOCONF=	YES
+USE_RC_SUBR=	YES
 
 # directories
 .if !defined(BATCH) && !defined(PACKAGE_BUILDING)
@@ -66,9 +67,16 @@
 SAMBA_VFSDIR?=	${PREFIX}/lib/samba
 
 # sample files
-STARTUP_SCRIPT=	${PREFIX}/etc/rc.d/samba.sh.sample
 SAMPLE_CONFIG=	${SAMBA_CONFDIR}/smb.conf.default
 
+# Startup Scripts
+SMBD_SCRIPT=	${PREFIX}/etc/rc.d/900smbd.sh
+NMBD_SCRIPT=	${PREFIX}/etc/rc.d/901nmbd.sh
+
+# Change to the following when rcorder is used on ${prefix}/etc/rc.d also.
+# SMBD_SCRIPT=	${PREFIX}/etc/rc.d/smbd.sh
+# NMBD_SCRIPT=	${PREFIX}/etc/rc.d/nmbd.sh
+
 CONFIGURE_ARGS=	--libdir=${SAMBA_CONFDIR} \
 		--localstatedir=${VARDIR} --with-swatdir=${PREFIX}/share/swat \
 		--with-sambabook=${PREFIX}/share/swat/using_samba \
@@ -184,17 +192,25 @@
 		WINBIND_NSS=${WINBIND_NSS} \
 		WINBIND_AUTH_CHALLENGE=${WINBIND_AUTH_CHALLENGE}
 
-.if defined(WITH_RECYCLE) || defined(WITH_AUDIT)
-post-build:
-	cd ${WRKDIR}/${DISTNAME}/examples/VFS; \
-		./configure;${GMAKE}; \
-		${RM} -f config.cache config.log config.status
-.endif
+RC_SCRIPTS_SUB=	PREFIX=${PREFIX} \
+		RC_SUBR=${RC_SUBR} \
+		SAMBA_CONFDIR=${SAMBA_CONFDIR}
 
 pre-build:
 	${RM} -fr ${WRKSRC}/include/proto.h
 	(cd ${WRKSRC} && make proto)
 
+post-build:
+.if defined(WITH_RECYCLE) || defined(WITH_AUDIT)
+	cd ${WRKDIR}/${DISTNAME}/examples/VFS; \
+		LIBTOOL=${LIBTOOL} ./configure;${GMAKE}; \
+		${RM} -f config.cache config.log config.status
+.endif
+.for script in nmbd.sh smbd.sh
+	@${SED} ${RC_SCRIPTS_SUB:S/$/!g/:S/^/ -e s!%%/:S/=/%%!/} \
+		${FILESDIR}/${script} > ${WRKDIR}/${script} 
+.endfor
+
 post-install:
 .if defined(WITH_WINBIND_NSS)
 	${INSTALL_PROGRAM} ${WRKSRC}/nsswitch/libnss_winbind.so ${PREFIX}/lib/nss_winbind.so.1
@@ -220,11 +236,8 @@
 		${RM} ${PREFIX}/share/examples/samba/VFS/$${file} ; \
 	done
 .endif
-	@if [ ! -f ${STARTUP_SCRIPT} ]; then				\
-		${ECHO} "Installing ${STARTUP_SCRIPT} startup file." ;	\
-		${INSTALL_SCRIPT} ${FILESDIR}/samba.sh.sample 		\
-			${STARTUP_SCRIPT} ;				\
-	fi
+	${INSTALL_SCRIPT} ${WRKDIR}/smbd.sh ${SMBD_SCRIPT}
+	${INSTALL_SCRIPT} ${WRKDIR}/nmbd.sh ${NMBD_SCRIPT}
 	@test -d ${SAMBA_SPOOL} || ${MKDIR} ${SAMBA_SPOOL} && ${CHMOD} 1777 ${SAMBA_SPOOL}
 	@if [ ! -f ${SAMPLE_CONFIG} ]; then				\
 		${SED} -e 's!%%SAMBA_SPOOL%%!${SAMBA_SPOOL}!'		\
Index: samba/pkg-plist
===================================================================
RCS file: /home/ncvs/ports/net/samba/pkg-plist,v
retrieving revision 1.48
diff -u -r1.48 pkg-plist
--- samba/pkg-plist	17 Apr 2003 14:21:54 -0000	1.48
+++ samba/pkg-plist	17 Apr 2003 23:51:39 -0000
@@ -55,7 +55,8 @@
 etc/codepages/unicode_map.ISO8859-7
 etc/codepages/unicode_map.ISO8859-9
 etc/codepages/unicode_map.KOI8-R
-etc/rc.d/samba.sh.sample
+etc/rc.d/900smbd.sh
+etc/rc.d/901nmbd.sh
 %%RECYCLE%%etc/recycle.conf.default
 etc/smb.conf.default
 %%AUDIT%%lib/samba/audit.so
Index: samba/files/nmbd.sh
===================================================================
RCS file: samba/files/nmbd.sh
diff -N samba/files/nmbd.sh
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ samba/files/nmbd.sh	9 Jul 2003 04:41:29 -0000
@@ -0,0 +1,37 @@
+#!/bin/sh
+#
+# $FreeBSD$
+#
+# PROVIDE: nmbd
+# REQUIRE: DAEMON smbd
+#
+# NOTE for FreeBSD 5.0+:
+# If you want this script to start with the base rc scripts
+# move nmbd.sh to /etc/rc.d/nmbd
+
+Define these nmbd_* variables in one of these files:
+#       /etc/rc.conf
+#	/etc/rc.conf.local
+#       /etc/rc.conf.d/nmbd
+#
+# DO NOT CHANGE THESE DEFAULT VALUES HERE
+#
+nmbd_enable="YES"			# Enable nmbd
+#nmbd_program="${prefix}/sbin/nmbd"	# Location of nmbd
+#nmbd_flags=""				# Flags to nmbd
+
+prefix=%%PREFIX%%
+
+. %%RC_SUBR%%
+
+name="nmbd"
+rcvar=`set_rcvar`
+command="$(prefix)/sbin/${name}"
+command_args="-D"	# _must_ start as daemon from rc.d;
+			# add more flags through ${${name}_flags}
+pidfile="/var/run/nmbd.pid"
+required_files="%%SAMBA_CONFDIR%%/smb.conf"
+extra_commands="reload"
+
+load_rc_config $name
+run_rc_command "$1"
Index: samba/files/samba.sh.sample
===================================================================
RCS file: samba/files/samba.sh.sample
diff -N samba/files/samba.sh.sample
--- samba/files/samba.sh.sample	16 Oct 2002 14:17:03 -0000	1.3
+++ /dev/null	1 Jan 1970 00:00:00 -0000
@@ -1,31 +0,0 @@
-#!/bin/sh
-
-rc_file=${0##*/}
-
-if ! PREFIX=$(expr $0 : "\(/.*\)/etc/rc\.d/${rc_file}\$"); then
-        echo "${rc_file}: Cannot determine PREFIX." >&2
-        echo "Please use the complete pathname." >&2
-        exit 64
-fi
-
-smbspool=/var/spool/samba
-pidfiledir=/var/run
-smbd=${PREFIX}/sbin/smbd
-nmbd=${PREFIX}/sbin/nmbd
-
-# start
-if [ "x$1" = "x" -o "x$1" = "xstart" ]; then
-	if [ -f $smbd ]; then
-		if [ -d $smbspool ]; then
-			rm -f $smbspool/*
-		fi
-		echo -n ' Samba'
-		$smbd -D
-		$nmbd -D
-	fi
-
-# stop
-elif [ "x$1" = "xstop" ]; then
-	kill `cat $pidfiledir/smbd.pid`
-	kill `cat $pidfiledir/nmbd.pid`
-fi
Index: samba/files/smbd.sh
===================================================================
RCS file: samba/files/smbd.sh
diff -N samba/files/smbd.sh
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ samba/files/smbd.sh	9 Jul 2003 04:35:16 -0000
@@ -0,0 +1,53 @@
+#!/bin/sh
+#
+# $FreeBSD$
+#
+# PROVIDE: smbd
+# BEFORE: nmbd
+# REQUIRE: DAEMON
+#
+# NOTE for FreeBSD 5.0+:
+# If you want this script to start with the base rc scripts
+# move smbd.sh to /etc/rc.d/smbd
+
+# Define these smbd_* variables in one of these files:
+#       /etc/rc.conf
+#	/etc/rc.conf.local
+#       /etc/rc.conf.d/smbd
+#
+# DO NOT CHANGE THESE DEFAULT VALUES HERE
+#
+smbd_enable="YES"			# Enable smbd
+#smbd_program="${prefix}/sbin/smbd"	# Location of smbd
+#smbd_flags=""				# Flags to smbd program
+#smbd_print_spooldir="/var/spool/samba"	# Location of Samba Print Spool
+
+prefix=%%PREFIX%%
+
+clear_print_spool()
+{
+	if [ -d $spooldir ]; then
+		rm -f $spooldir/*
+	fi
+}
+
+. %%RC_SUBR%%
+
+name="smbd"
+rcvar=`set_rcvar`
+command="$(prefix)/sbin/${name}"
+command_args="-D"	# _must_ start as daemon from rc.d;
+			# add more flags through ${${name}_flags}
+pidfile="/var/run/smbd.pid"
+required_files="%%SAMBA_CONFDIR%%/smb.conf"
+spooldir="/var/spool/samba"
+extra_commands="reload"
+start_precmd="clear_smbspool"
+
+load_rc_config $name
+
+if [ -n "$smbd_print_spooldir" ]; then
+	spooldir=$smbd_print_spooldir
+fi
+
+run_rc_command "$1"
Index: samba-devel/Makefile
===================================================================
RCS file: /home/ncvs/ports/net/samba-devel/Makefile,v
retrieving revision 1.92
diff -u -r1.92 Makefile
--- samba-devel/Makefile	27 Jun 2003 07:21:40 -0000	1.92
+++ samba-devel/Makefile	10 Jul 2003 22:33:19 -0000
@@ -17,6 +17,7 @@
 COMMENT=	A free SMB and CIFS client and server for UNIX
 
 USE_BZIP2="YES"
+USE_RC_SUBR="YES"
 
 .if !defined(WITHOUT_CUPS)
 WITH_CUPS=	yes
@@ -34,10 +35,17 @@
 SAMBA_LOGDIR=	${VARDIR}/log
 SAMBA_PRIVATE=	${PREFIX}/private
 SAMBA_CONFDIR=	${PREFIX}/etc
+
 # sample files
-STARTUP_SCRIPT=	${PREFIX}/etc/rc.d/samba.sh.sample
 SAMPLE_CONFIG=	${SAMBA_CONFDIR}/smb.conf.default
-DOCSDIR=	${PREFIX}/share/doc/samba
+
+# Startup Scripts  
+SMBD_SCRIPT=    ${PREFIX}/etc/rc.d/900smbd.sh
+NMBD_SCRIPT=    ${PREFIX}/etc/rc.d/901nmbd.sh
+
+# Change to the following when rcorder is used on ${prefix}/etc/rc.d also.
+# SMBD_SCRIPT=  ${PREFIX}/etc/rc.d/smbd.sh
+# NMBD_SCRIPT=  ${PREFIX}/etc/rc.d/nmbd.sh
 
 NO_LATEST_LINK=	yes
 USE_AUTOCONF=	yes
@@ -100,14 +108,28 @@
 MAN8=		nmbd.8 smbd.8 smbmnt.8 smbmount.8 net.8 pdbedit.8 \
 		smbpasswd.8 smbspool.8 smbumount.8 swat.8 winbindd.8
 
+RC_SCRIPTS_SUB= PREFIX=${PREFIX} \
+		RC_SUBR=${RC_SUBR} \
+		SAMBA_CONFDIR=${SAMBA_CONFDIR}
+
+post-build:
+.for script in nmbd.sh smbd.sh
+	@${SED} ${RC_SCRIPTS_SUB:S/$/!g/:S/^/ -e s!%%/:S/=/%%!/} \
+		${FILESDIR}/${script} > ${WRKDIR}/${script}
+.endfor
+
 post-install:
 	${MKDIR} ${PREFIX}/share/examples/samba
 	${CP} -rp ${WRKDIR}/${DISTNAME}/examples/* ${PREFIX}/share/examples/samba
-	@if [ ! -f ${STARTUP_SCRIPT} ]; then				\
-		${ECHO} "Installing ${STARTUP_SCRIPT} startup file." ;	\
-		${INSTALL_SCRIPT} ${FILESDIR}/samba.sh.sample 		\
-			${STARTUP_SCRIPT} ;				\
+	@if [ ! -f ${SMBD_SCRIPT} ]; then				\
+		${ECHO} "Installing ${SMBD_SCRIPT} startup file." ;	\
+		${INSTALL_SCRIPT} ${WRKDIR}/smbd.sh ${SMBD_SCRIPT} ;	\
+	fi
+	@if [ ! -f ${NMBD_SCRIPT} ]; then 				\
+		${ECHO} "Installing ${NMBD_SCRIPT} startup file." ;	\
+		${INSTALL_SCRIPT} ${WRKDIR}/nmbd.sh ${NMBD_SCRIPT} ;	\
 	fi
+.endfor
 	@test -d ${SAMBA_SPOOL} || ${MKDIR} ${SAMBA_SPOOL} && ${CHMOD} 1777 ${SAMBA_SPOOL}
 	@if [ ! -f ${SAMPLE_CONFIG} ]; then				\
 		${SED} -e 's!%%SAMBA_SPOOL%%!${SAMBA_SPOOL}!'		\
Index: samba-devel/pkg-plist
===================================================================
RCS file: /home/ncvs/ports/net/samba-devel/pkg-plist,v
retrieving revision 1.40
diff -u -r1.40 pkg-plist
--- samba-devel/pkg-plist	27 Jun 2003 07:21:40 -0000	1.40
+++ samba-devel/pkg-plist	10 Jul 2003 22:33:51 -0000
@@ -19,7 +19,8 @@
 bin/tdbbackup
 bin/testparm
 bin/testprns
-etc/rc.d/samba.sh.sample
+etc/rc.d/900smbd.sh
+etc/rc.d/901nmbd.sh
 etc/lowcase.dat
 etc/smb.conf.default
 etc/upcase.dat
Index: samba-devel/files/README.FreeBSD
===================================================================
RCS file: /home/ncvs/ports/net/samba-devel/files/README.FreeBSD,v
retrieving revision 1.3
diff -u -r1.3 README.FreeBSD
--- samba-devel/files/README.FreeBSD	19 Feb 1998 10:21:20 -0000	1.3
+++ samba-devel/files/README.FreeBSD	26 Aug 2001 18:05:18 -0000
@@ -10,12 +10,10 @@
 
 FreeBSD Samba ports for localization and encrypt passwords support are no
 longer provided because these supports have been integrated into the
-original distribution since 1.9.18.  If you're Western European or Japanese
-Windows users, please set "client code page" parameter in smb.conf (1.9.18
-does not support Chinese Windows. If you want to use Chinese samba, please
-use chinese/samba port).  See smb.conf.sample for details.  If you want to
-use NT4+SP3 or Win95+updates clients, set "encrypt passwords" parameter to
-yes and use smbpasswd [username] to use /usr/local/private/smbpasswd for
-authentication.
+original distribution since 1.9.18.  If you're Western European, Japanese,
+or Chinese Windows users, please set "client code page" parameter in smb.conf.
+See smb.conf.sample for details.  If you want to use NT4+SP3 or Win95+updates
+clients, set "encrypt passwords" parameter to yes and use smbpasswd [username]
+to use /usr/local/private/smbpasswd for authentication.
 
 FreeBSD SAMBA ports maintainer: Tatsumi Hosokawa <hosokawa at jp.FreeBSD.org>
Index: samba-devel/files/nmbd.sh
===================================================================
RCS file: samba-devel/files/nmbd.sh
diff -N samba-devel/files/nmbd.sh
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ samba-devel/files/nmbd.sh	10 Jul 2003 22:22:16 -0000
@@ -0,0 +1,37 @@
+#!/bin/sh
+#
+# $FreeBSD$
+#
+# PROVIDE: nmbd
+# REQUIRE: DAEMON smbd
+#
+# NOTE for FreeBSD 5.0+:
+# If you want this script to start with the base rc scripts
+# move nmbd.sh to /etc/rc.d/nmbd
+
+Define these nmbd_* variables in one of these files:
+#       /etc/rc.conf
+#	/etc/rc.conf.local
+#       /etc/rc.conf.d/nmbd
+#
+# DO NOT CHANGE THESE DEFAULT VALUES HERE
+#
+nmbd_enable="YES"			# Enable nmbd
+#nmbd_program="${prefix}/sbin/nmbd"	# Location of nmbd
+#nmbd_flags=""				# Flags to nmbd
+
+prefix=%%PREFIX%%
+
+. %%RC_SUBR%%
+
+name="nmbd"
+rcvar=`set_rcvar`
+command="$(prefix)/sbin/${name}"
+command_args="-D"	# _must_ start as daemon from rc.d;
+			# add more flags through ${${name}_flags}
+pidfile="/var/run/nmbd.pid"
+required_files="%%SAMBA_CONFDIR%%/smb.conf"
+extra_commands="reload"
+
+load_rc_config $name
+run_rc_command "$1"
Index: samba-devel/files/samba.sh.sample
===================================================================
RCS file: samba-devel/files/samba.sh.sample
diff -N samba-devel/files/samba.sh.sample
--- samba-devel/files/samba.sh.sample	18 Jan 1999 02:34:05 -0000	1.2
+++ /dev/null	1 Jan 1970 00:00:00 -0000
@@ -1,22 +0,0 @@
-#!/bin/sh
-smbspool=/var/spool/samba
-pidfiledir=/var/run
-smbd=/usr/local/sbin/smbd
-nmbd=/usr/local/sbin/nmbd
-
-# start
-if [ "x$1" = "x" -o "x$1" = "xstart" ]; then
-	if [ -f $smbd ]; then
-		if [ -d $smbspool ]; then
-			rm -f $smbspool/*
-		fi
-		echo -n ' Samba'
-		$smbd -D
-		$nmbd -D
-	fi
-
-# stop
-elif [ "x$1" = "xstop" ]; then
-	kill `cat $pidfiledir/smbd.pid`
-	kill `cat $pidfiledir/nmbd.pid`
-fi
Index: samba-devel/files/smbd.sh
===================================================================
RCS file: samba-devel/files/smbd.sh
diff -N samba-devel/files/smbd.sh
--- /dev/null	1 Jan 1970 00:00:00 -0000
+++ samba-devel/files/smbd.sh	10 Jul 2003 22:22:16 -0000
@@ -0,0 +1,53 @@
+#!/bin/sh
+#
+# $FreeBSD$
+#
+# PROVIDE: smbd
+# BEFORE: nmbd
+# REQUIRE: DAEMON
+#
+# NOTE for FreeBSD 5.0+:
+# If you want this script to start with the base rc scripts
+# move smbd.sh to /etc/rc.d/smbd
+
+# Define these smbd_* variables in one of these files:
+#       /etc/rc.conf
+#	/etc/rc.conf.local
+#       /etc/rc.conf.d/smbd
+#
+# DO NOT CHANGE THESE DEFAULT VALUES HERE
+#
+smbd_enable="YES"			# Enable smbd
+#smbd_program="${prefix}/sbin/smbd"	# Location of smbd
+#smbd_flags=""				# Flags to smbd program
+#smbd_print_spooldir="/var/spool/samba"	# Location of Samba Print Spool
+
+prefix=%%PREFIX%%
+
+clear_print_spool()
+{
+	if [ -d $spooldir ]; then
+		rm -f $spooldir/*
+	fi
+}
+
+. %%RC_SUBR%%
+
+name="smbd"
+rcvar=`set_rcvar`
+command="$(prefix)/sbin/${name}"
+command_args="-D"	# _must_ start as daemon from rc.d;
+			# add more flags through ${${name}_flags}
+pidfile="/var/run/smbd.pid"
+required_files="%%SAMBA_CONFDIR%%/smb.conf"
+spooldir="/var/spool/samba"
+extra_commands="reload"
+start_precmd="clear_smbspool"
+
+load_rc_config $name
+
+if [ -n "$smbd_print_spooldir" ]; then
+	spooldir=$smbd_print_spooldir
+fi
+
+run_rc_command "$1"
>Release-Note:
>Audit-Trail:
>Unformatted:



More information about the freebsd-ports-bugs mailing list