cvs commit: ports/databases/couchdb Makefile ports/databases/couchdb/files couchdb.in

Doug Barton dougb at FreeBSD.org
Wed Aug 31 02:07:19 UTC 2011


Attached are some improvements to the rc.d script. Most of them should
be obvious, let me know if you have any questions.


Doug


On 08/25/2011 03:58, Ashish SHUKLA wrote:
> ashish      2011-08-25 10:58:47 UTC
> 
>   FreeBSD ports repository
> 
>   Modified files:
>     databases/couchdb    Makefile 
>     databases/couchdb/files couchdb.in 
>   Log:
>   - Remove extra USERS/GROUPS, which were accidentally added in previous commit[1]
>   - Fix rc.d script[1]
>   - Add option to depend on lang/erlang instead of lang/erlang-lite
>   
>   Submitted by:   till at php.net[1]
>   Approved by:    till at php.net (maintainer)
>   
>   Revision  Changes    Path
>   1.17      +15 -5     ports/databases/couchdb/Makefile
>   1.7       +1 -1      ports/databases/couchdb/files/couchdb.in
> 
> http://www.FreeBSD.org/cgi/cvsweb.cgi/ports/databases/couchdb/Makefile.diff?&r1=1.16&r2=1.17&f=h
> http://www.FreeBSD.org/cgi/cvsweb.cgi/ports/databases/couchdb/files/couchdb.in.diff?&r1=1.6&r2=1.7&f=h
> 



-- 

	Nothin' ever doesn't change, but nothin' changes much.
			-- OK Go

	Breadth of IT experience, and depth of knowledge in the DNS.
	Yours for the right price.  :)  http://SupersetSolutions.com/

-------------- next part --------------
Index: Makefile
===================================================================
RCS file: /home/pcvs/ports/databases/couchdb/Makefile,v
retrieving revision 1.17
diff -u -r1.17 Makefile
--- Makefile	25 Aug 2011 10:58:47 -0000	1.17
+++ Makefile	31 Aug 2011 02:04:24 -0000
@@ -8,7 +8,7 @@
 PORTNAME=	couchdb
 PORTVERSION=	1.1.0
 PORTEPOCH=	1
-PORTREVISION=	1
+PORTREVISION=	2
 CATEGORIES=	databases
 MASTER_SITES=	${MASTER_SITE_APACHE}
 MASTER_SITE_SUBDIR=	couchdb/${PORTVERSION}
Index: files/couchdb.in
===================================================================
RCS file: /home/pcvs/ports/databases/couchdb/files/couchdb.in,v
retrieving revision 1.7
diff -u -r1.7 couchdb.in
--- files/couchdb.in	25 Aug 2011 10:58:47 -0000	1.7
+++ files/couchdb.in	31 Aug 2011 02:04:24 -0000
@@ -1,7 +1,10 @@
 #!/bin/sh
 
+# $FreeBSD$
+#
 # PROVIDE: couchdb
 # REQUIRE: LOGIN
+# KEYWORD: shutdown
 #
 # Add the following lines to /etc/rc.conf.local or /etc/rc.conf
 # to enable this service:
@@ -16,12 +19,6 @@
 #
 # couchdb_respawn (int):	Set to none by default. If CouchDB crashes,
 # 				respawn after this many seconds.
-#
-
-couchdb_user="${couchdb_user:-"couchdb"}"
-couchdb_enablelogs="${couchdb_enablelogs:-"YES"}"
-couchdb_etcdir="${couchdb_etcdir:-"%%PREFIX%%/etc/couchdb"}"
-couchdb_respawn="${couchdb_respawn:-"0"}"
 
 . /etc/rc.subr
 
@@ -30,35 +27,38 @@
 
 load_rc_config $name
 
+: ${couchdb_enable="NO"}
+couchdb_user="${couchdb_user:-"couchdb"}"
+couchdb_enablelogs="${couchdb_enablelogs:-"YES"}"
+couchdb_etcdir="${couchdb_etcdir:-"%%PREFIX%%/etc/couchdb"}"
+couchdb_respawn="${couchdb_respawn:-"0"}"
+
 command="%%PREFIX%%/bin/${name}"
 pidfile="/var/run/${name}/${name}.pid"
-etcdir="%%PREFIX%%/etc/${name}"
 
-if [ "$couchdb_respawn" -gt 0 ]
-    then
-        respawn="-r ${couchdb_respawn} "
-fi
-
-if [ "$couchdb_enablelogs" = "YES" ]
-    then
-        logfile=/var/log/${name}/couch.log
-        errfile=/var/log/${name}/err.log
-    else
-        logfile=/dev/null
-        errfile=/dev/null
-fi
+couchdb_prestart()
+{
+	install -o $couchdb_user /dev/null $pidfile
 
-: ${couchdb_enable="NO"}
-: ${couchdb_flags="-b -a ${etcdir}/default.ini -a ${etcdir}/local.ini ${respawn}-o ${logfile} -e ${errfile} -p ${pidfile}"}
+	[ -n "$couchdb_flags" ] && return 0
 
-start_precmd=pid_touch
-stop_cmd="${command} -d"
-status_cmd="${command} -s"
+	if [ $couchdb_respawn -gt 0 ]; then
+		respawn="-r ${couchdb_respawn}"
+	fi
+
+	if checkyesno couchdb_enablelogs; then
+		logfile=/var/log/${name}/couch.log
+		errfile=/var/log/${name}/err.log
+	else
+		logfile=/dev/null
+		errfile=/dev/null
+	fi
 
-pid_touch ()
-{
-    touch $pidfile
-    chown $couchdb_user $pidfile
+	couchdb_flags="-b -a ${couchdb_etcdir}/default.ini -a ${couchdb_etcdir}/local.ini ${respawn} -o ${logfile} -e ${errfile} -p ${pidfile}"
 }
 
+start_precmd=${name}_prestart
+stop_cmd="${command} -d"
+status_cmd="${command} -s"
+
 run_rc_command "$1"


More information about the cvs-all mailing list