aboutsummaryrefslogtreecommitdiff
path: root/databases/couchdb
diff options
context:
space:
mode:
authorWesley Shields <wxs@FreeBSD.org>2009-06-17 14:10:30 +0000
committerWesley Shields <wxs@FreeBSD.org>2009-06-17 14:10:30 +0000
commit7622f83fd1b35ce0643c0d97434b4e222ee57c71 (patch)
treeb18b6ccbc9661087b1e66712674e444247739d7e /databases/couchdb
parentd581c2b9fc47b45d4546994a0026eb0547d21989 (diff)
Notes
Diffstat (limited to 'databases/couchdb')
-rw-r--r--databases/couchdb/Makefile21
-rw-r--r--databases/couchdb/files/couchdb.in64
-rw-r--r--databases/couchdb/pkg-install32
-rw-r--r--databases/couchdb/pkg-message8
4 files changed, 125 insertions, 0 deletions
diff --git a/databases/couchdb/Makefile b/databases/couchdb/Makefile
index 49a4f46529cf..e4f2e316447c 100644
--- a/databases/couchdb/Makefile
+++ b/databases/couchdb/Makefile
@@ -7,6 +7,7 @@
PORTNAME= couchdb
PORTVERSION= 0.9.0
+PORTREVISION= 1
PORTEPOCH= 1
CATEGORIES= databases
MASTER_SITES= ${MASTER_SITE_APACHE}
@@ -22,6 +23,12 @@ LIB_DEPENDS= icudata:${PORTSDIR}/devel/icu \
BUILD_DEPENDS= ${LOCALBASE}/lib/erlang/usr/include/erl_driver.h:${PORTSDIR}/lang/erlang-lite
RUN_DEPENDS= ${BUILD_DEPENDS}
+COUCH_VARDIR?= /var
+COUCH_DBDIR?= ${COUCH_VARDIR}/db/couchdb
+COUCH_LOGDIR?= ${COUCH_VARDIR}/log/couchdb
+COUCH_USER?= couchdb
+
+USE_RC_SUBR= couchdb
USE_GMAKE= yes
USE_AUTOTOOLS= libtool:15
USE_LDCONFIG= yes
@@ -33,9 +40,23 @@ CONFIGURE_ARGS= --with-erlang=${LOCALBASE}/lib/erlang/usr/include \
MAN1= couchdb.1 couchjs.1
+pre-fetch:
+ @${ECHO_MSG} ""
+ @${ECHO_MSG} "If you are upgrading CouchDB, please double-check that the datafile is compatible."
+ @${ECHO_MSG} ""
+
post-patch:
.if defined(NOPORTDOCS)
@${REINPLACE_CMD} -e 's/install-data-am$$//' ${WRKSRC}/Makefile.in
.endif
+pre-install:
+ @${SH} ${PKGINSTALL} ${PORTNAME} PRE-INSTALL
+
+post-install:
+ @${CAT} ${PKGMESSAGE}
+ ${MKDIR} ${COUCH_DBDIR}
+ ${CHOWN} ${COUCH_USER} ${COUCH_DBDIR}
+ ${CHOWN} ${COUCH_USER} ${COUCH_LOGDIR}
+
.include <bsd.port.mk>
diff --git a/databases/couchdb/files/couchdb.in b/databases/couchdb/files/couchdb.in
new file mode 100644
index 000000000000..bb6cc7e072bd
--- /dev/null
+++ b/databases/couchdb/files/couchdb.in
@@ -0,0 +1,64 @@
+#!/bin/sh
+
+# PROVIDE: couchdb
+# REQUIRE: LOGIN
+#
+# Add the following lines to /etc/rc.conf.local or /etc/rc.conf
+# to enable this service:
+#
+# couchdb_enable (bool): Set to NO by default.
+# Set it to YES to enable couchdb.
+#
+# couchdb_enablelogs (bool): Set to YES by default.
+#
+# couchdb_etcdir (string): In case you want another dir
+# for default.ini/local.ini.
+#
+# 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"}"
+
+. %%RC_SUBR%%
+
+name="couchdb"
+rcvar=${name}_enable
+
+load_rc_config $name
+
+command="%%PREFIX%%/bin/${name}"
+pidfile="/var/run/${name}.pid"
+etcdir="%%PREFIX%%/etc/${name}"
+respawn=""
+
+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_enable="NO"}
+: ${couchdb_flags="-b -c ${etcdir}/default.ini -c ${etcdir}/local.ini ${respawn}-o ${logfile} -e ${errfile} -p ${pidfile}"}
+
+start_precmd=pid_touch
+stop_cmd="${command} -d && rm -f ${pidfile}"
+
+pid_touch ()
+{
+ touch $pidfile
+ chown $couchdb_user $pidfile
+}
+
+run_rc_command "$1"
diff --git a/databases/couchdb/pkg-install b/databases/couchdb/pkg-install
new file mode 100644
index 000000000000..7fe4328dbf37
--- /dev/null
+++ b/databases/couchdb/pkg-install
@@ -0,0 +1,32 @@
+#!/bin/sh
+
+PATH=/bin:/usr/sbin
+
+USER=couchdb
+GROUP=couchdb
+UID=919
+GID=919
+
+case $2 in
+ PRE-INSTALL)
+ if pw user show "${USER}" 2>/dev/null; then
+ echo "You already have a user \"${USER}\", so I will use it."
+ else
+ if pw groupadd ${GROUP} -g ${GID}
+ then
+ echo "Added group \"${GROUP}\"."
+ else
+ echo "Adding group \"${GROUP}\" failed..."
+ exit 1
+ fi
+ if pw useradd ${USER} -u ${UID} -g ${GROUP} -h - \
+ -s /usr/sbin/nologin -L daemon -d /var/empty -c "CouchDB Account"
+ then
+ echo "Added user \"${USER}\"."
+ else
+ echo "Adding user \"${USER}\" failed..."
+ exit 1
+ fi
+ fi
+ ;;
+esac
diff --git a/databases/couchdb/pkg-message b/databases/couchdb/pkg-message
new file mode 100644
index 000000000000..a810ac2006c9
--- /dev/null
+++ b/databases/couchdb/pkg-message
@@ -0,0 +1,8 @@
+===> COMPATIBILITY NOTE:
+ CouchDB is still pre-stable; between 0.8 and 0.9 the database format
+ changed which breaks BC. In current trunk, the format changed again, so
+ please double-check in case you are updating an existing installation.
+
+ More info:
+ * http://wiki.apache.org/couchdb/Breaking_changes?action=show&redirect=BreakingChanges
+ * http://wiki.apache.org/couchdb/BreakingChangesUpdateTrunkTo0Dot9