Date: Fri, 4 Oct 2002 16:02:47 -0500 (CDT) From: "Scot W. Hetzel" <hetzels@westbend.net> To: FreeBSD-gnats-submit@FreeBSD.org Cc: lodea@vet.com.au Subject: ports/43670: RC_NG script for net/openldap Message-ID: <200210042102.g94L2lTe030656@WBIw009.westbend.net>
next in thread | raw e-mail | index | archive | help
>Number: 43670 >Category: ports >Synopsis: RC_NG script for net/openldap >Confidential: no >Severity: non-critical >Priority: low >Responsible: freebsd-ports >State: open >Quarter: >Keywords: >Date-Required: >Class: change-request >Submitter-Id: current-users >Arrival-Date: Fri Oct 04 14:10:03 PDT 2002 >Closed-Date: >Last-Modified: >Originator: Scot W. Hetzel >Release: FreeBSD 5.0-CURRENT i386 >Organization: West Bend Internet >Environment: System: FreeBSD Current.westbend.net 5.0-CURRENT FreeBSD 5.0-CURRENT #5: Tue Sep 24 11:27:41 CDT 2002 root@Current.westbend.net:/usr/obj/usr/src/srcC/sys/GENERIC-SMP i386 >Description: While looking at the RC_NG scripts on 5.0-CURRENT, I looked at converting the ports rc startup scripts to RC_NG. I decided to start with cyrus-imapd and the ports that it depends on (cyrus-sasl, openldap, openldap2, mysql323-client). To ensure compatibility with previous FreeBSD Releases, the rc scripts contain both the new RC_NG and pre RC_NG scripts. >How-To-Repeat: >Fix: Changed Files: files/slapd.sh - Convert to RC_NG Index: files/slapd.sh =================================================================== RCS file: /home/ncvs/ports/net/openldap/files/slapd.sh,v retrieving revision 1.1 diff -u -r1.1 slapd.sh --- files/slapd.sh 25 Sep 2000 05:43:46 -0000 1.1 +++ files/slapd.sh 4 Oct 2002 20:46:21 -0000 @@ -2,30 +2,99 @@ # # $FreeBSD: ports/net/openldap/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 +# Define the following slapd_* variables in one of the following: +# /etc/rc.conf +# /etc/rc.conf.d/slapd +# ${prefix}/etc/rc.conf.d/slapd +# +# slapd_enable - Set to YES to enable slapd +# +# slapd_program - Path to slapd program +# Default: ${prefix}/libexec/slapd +# +# slapd_flags - Additional arguments to slapd -exit 0 +prefix=@@PREFIX@@ + +if [ -f /etc/rc.subr ]; then + + . /etc/rc.subr + + name="slapd" + rcvar=`set_rcvar` + command="${prefix}/libexec/slapd" + pidfile=/var/run/slapd.pid + required_files="${prefix}/etc/openldap/slapd.conf ${prefix}/etc/openldap/ldap.conf" + + # The below may be removed when load_local_rc_config is added to rc.subr + + if [ -f ${prefix}/etc/rc.conf.d/"$name" ]; then + debug "Sourcing ${prefix}/etc/rc.conf.d/${name}" + . ${prefix}/etc/rc.conf.d/"$name" + fi + + load_rc_config $name + + if [ -z "${slapd_enable}" ] ; then + slapd_enable=yes + fi + + # The above may be removed when load_local_rc_config is added to rc.subr + # + # load_local_rc_config $name + run_rc_command "$1" +else + # Suck in the configuration variables. + if [ -z "${source_rc_confs_defined}" ]; then + if [ -r /etc/defaults/rc.conf ]; then + . /etc/defaults/rc.conf + source_rc_confs + elif [ -r /etc/rc.conf ]; then + . /etc/rc.conf + fi + fi + + if [ -f ${prefix}/etc/rc.conf.d/slapd" ]; then + . ${prefix}/etc/rc.conf.d/slapd}" + fi + + if [ -z "${slapd_program}" ]; then + slapd_program=${prefix}/libexec/slapd + fi + + pidfile=/var/run/slapd.pid + + case "$1" in + start) + if [ -x $slapd ]; then + echo -n ' slapd' + ${slapd_program} ${slapd_flags} + + 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 + + exit 0 +fi >Release-Note: >Audit-Trail: >Unformatted: To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-ports" in the body of the message
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200210042102.g94L2lTe030656>