From owner-freebsd-ports Fri Oct 4 14:10:34 2002 Delivered-To: freebsd-ports@hub.freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id A18BF37B407 for ; Fri, 4 Oct 2002 14:10:08 -0700 (PDT) Received: from freefall.freebsd.org (freefall.freebsd.org [216.136.204.21]) by mx1.FreeBSD.org (Postfix) with ESMTP id 6CD4D43E7B for ; Fri, 4 Oct 2002 14:10:04 -0700 (PDT) (envelope-from gnats@FreeBSD.org) Received: from freefall.freebsd.org (gnats@localhost [127.0.0.1]) by freefall.freebsd.org (8.12.6/8.12.6) with ESMTP id g94LA3Co055161 for ; Fri, 4 Oct 2002 14:10:03 -0700 (PDT) (envelope-from gnats@freefall.freebsd.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.12.6/8.12.6/Submit) id g94LA3m0055160; Fri, 4 Oct 2002 14:10:03 -0700 (PDT) Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 4E67837B401 for ; Fri, 4 Oct 2002 14:02:51 -0700 (PDT) Received: from mail.westbend.net (ns1.westbend.net [216.47.253.3]) by mx1.FreeBSD.org (Postfix) with ESMTP id 9684643E6E for ; Fri, 4 Oct 2002 14:02:50 -0700 (PDT) (envelope-from hetzels@WBIw009.westbend.net) Received: from WBIw009.westbend.net (wbiw009 [216.47.253.29]) by mail.westbend.net (8.12.5/8.12.5) with ESMTP id g94L2nrH057799; Fri, 4 Oct 2002 16:02:49 -0500 (CDT) (envelope-from hetzels@WBIw009.westbend.net) Received: from WBIw009.westbend.net (localhost [127.0.0.1]) by WBIw009.westbend.net (8.12.6/8.12.6) with ESMTP id g94L2nJ0030657; Fri, 4 Oct 2002 16:02:49 -0500 (CDT) (envelope-from hetzels@WBIw009.westbend.net) Received: (from root@localhost) by WBIw009.westbend.net (8.12.6/8.12.6/Submit) id g94L2lTe030656; Fri, 4 Oct 2002 16:02:47 -0500 (CDT) Message-Id: <200210042102.g94L2lTe030656@WBIw009.westbend.net> Date: Fri, 4 Oct 2002 16:02:47 -0500 (CDT) From: "Scot W. Hetzel" Reply-To: "Scot W. Hetzel" To: FreeBSD-gnats-submit@FreeBSD.org Cc: lodea@vet.com.au X-Send-Pr-Version: 3.113 Subject: ports/43670: RC_NG script for net/openldap Sender: owner-freebsd-ports@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.org >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 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 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