diff --git a/databases/Makefile b/databases/Makefile index 4e1ca810a417..9b17b87625c9 100644 --- a/databases/Makefile +++ b/databases/Makefile @@ -171,6 +171,7 @@ SUBDIR += memcachedb SUBDIR += metakit SUBDIR += mird + SUBDIR += mongodb SUBDIR += mrtg-mysql-load SUBDIR += msql SUBDIR += msql3 diff --git a/databases/mongodb/Makefile b/databases/mongodb/Makefile new file mode 100644 index 000000000000..7d90f73d2bb2 --- /dev/null +++ b/databases/mongodb/Makefile @@ -0,0 +1,56 @@ +# New ports collection makefile for: mongodb +# Date created: 3 November 2009 +# Whom: Mirko Zinn +# +# $FreeBSD$ +# + +PORTNAME= mongodb +PORTVERSION= 1.0.1 +CATEGORIES= databases net +MASTER_SITES= http://download.github.com/ \ + http://derzinn.de/files/ +DISTNAME= mongodb-mongo-e316c78 + +MAINTAINER= mail@derzinn.de +COMMENT= A NOSQL distributed document-oriented database + +LIB_DEPENDS= boost_system:${PORTSDIR}/devel/boost-libs \ + js:${PORTSDIR}/lang/spidermonkey \ + pcre:${PORTSDIR}/devel/pcre \ + nspr4:${PORTSDIR}/devel/nspr \ + execinfo.1:${PORTSDIR}/devel/libexecinfo + +CONFLICTS= mongodb-devel-[0-9]* + +USE_SCONS= yes +SCONS_TARGET= all + +USE_RC_SUBR= mongod +MONGO_FILES= mongo mongod mongodump mongoexport mongofiles \ + mongoimportjson mongorestore mongos mongosniff + +.include +.if ${OSVERSION} < 700042 +BROKEN= Does not build +.endif + +post-patch: + @${REINPLACE_CMD} -E -e 's|elif "freebsd7" == os.sys.platform|elif os.sys.platform.startswith("freebsd")|' \ + ${WRKSRC}/SConstruct + @${REINPLACE_CMD} -e 's#/usr/local#${PREFIX}#g' ${WRKSRC}/SConstruct + +do-install: +.for i in ${MONGO_FILES} + ${INSTALL_PROGRAM} ${WRKSRC}/${i} ${PREFIX}/bin +.endfor + ${INSTALL_DATA} ${WRKSRC}/libmongoclient.a ${PREFIX}/lib + +post-install: + @if [ ! -f ${PREFIX}/etc/mongodb.conf ]; then \ + ${TOUCH} ${PREFIX}/etc/mongodb.conf ; \ + fi + + PKG_PREFIX=${PREFIX} ${SH} ${PKGINSTALL} ${PKGNAME} PRE-INSTALL + +.include diff --git a/databases/mongodb/distinfo b/databases/mongodb/distinfo new file mode 100644 index 000000000000..61d2c4a16565 --- /dev/null +++ b/databases/mongodb/distinfo @@ -0,0 +1,3 @@ +MD5 (mongodb-mongo-e316c78.tar.gz) = 93cf5cf75ee020c31e1b3a8627f80d83 +SHA256 (mongodb-mongo-e316c78.tar.gz) = 509f34c847e6d63f898e0337717fa78f2389e82ed6a6bb5f47df70bd2cfb1af2 +SIZE (mongodb-mongo-e316c78.tar.gz) = 3922059 diff --git a/databases/mongodb/files/mongod.in b/databases/mongodb/files/mongod.in new file mode 100644 index 000000000000..ddfd1d5400ea --- /dev/null +++ b/databases/mongodb/files/mongod.in @@ -0,0 +1,39 @@ +#!/bin/sh + +# PROVIDE: mongod +# REQUIRE: NETWORK +# +# Add the following lines to /etc/rc.conf.local or /etc/rc.conf +# to enable this service: +# +# mongod_enable (bool): Set to NO by default. +# Set it to YES to enable mongod. +# +# Additional configurable variables: +# mongod_config (path): Set to %%PREFIX%%/etc/mongod.conf +# by default. Additional configuration. You +# can also use mongod_flags for additional +# command line arguments. +# mongod_dbpath (path): Set to /var/db/mongod by default +# mongod_user (username): Set to "mongod" by default + +. %%RC_SUBR%% + +name="mongod" +rcvar=${name}_enable + +command=%%PREFIX%%/bin/${name} + +load_rc_config $name + +: ${mongod_enable="NO"} +: ${mongod_config="%%PREFIX%%/etc/mongodb.conf"} +: ${mongod_dbpath="/var/db/mongodb"} +: ${mongod_user="mongodb"} + +command_args="-f $mongod_config --dbpath $mongod_dbpath --logappend --logpath $mongod_dbpath/mongod.log --fork" + +required_dirs=${mongod_dbpath} + +run_rc_command "$1" + diff --git a/databases/mongodb/pkg-deinstall b/databases/mongodb/pkg-deinstall new file mode 100644 index 000000000000..1c7a5bf2805d --- /dev/null +++ b/databases/mongodb/pkg-deinstall @@ -0,0 +1,15 @@ +#!/bin/sh +# $FreeBSD$ +# + +if [ "$2" != "POST-DEINSTALL" ]; then + exit 0 +fi + +USER=mongodb + +if pw usershow "${USER}" 2>/dev/null 1>&2; then + echo "To delete mongodb user permanently, use 'pw userdel ${USER}'" +fi + +exit 0 diff --git a/databases/mongodb/pkg-descr b/databases/mongodb/pkg-descr new file mode 100644 index 000000000000..24f53e80363b --- /dev/null +++ b/databases/mongodb/pkg-descr @@ -0,0 +1,5 @@ +Mongo (from "humongous") is a high-performance, open source, +schema-free, document-oriented database. A common name in the +"NOSQL" community. + +WWW: http://www.mongodb.org/ diff --git a/databases/mongodb/pkg-install b/databases/mongodb/pkg-install new file mode 100644 index 000000000000..3faf828e0b3c --- /dev/null +++ b/databases/mongodb/pkg-install @@ -0,0 +1,43 @@ +#!/bin/sh +# $FreeBSD$ +# + +if [ "$2" != "PRE-INSTALL" ]; then + exit 0 +fi + +USER=mongodb +GROUP=${USER} +UID=922 +GID=${UID} +DBDIR=/var/db/mongodb + +#touch ${PREFIX}/etc/mongodb.conf + +if ! pw groupshow "${GROUP}" 2>/dev/null 1>&2; then + if pw groupadd ${GROUP} -g ${GID}; then + echo "Added group \"${GROUP}\"." + else + echo "Adding group \"${GROUP}\" failed..." + exit 1 + fi +fi + +if ! pw usershow "${USER}" 2>/dev/null 1>&2; then + if pw useradd ${USER} -u ${UID} -g ${GROUP} -h - \ + -s "/bin/sh" -d "/var/db/mongodb" \ + -c "mongodb pseudo-user"; \ + then + echo "Added user \"${USER}\"." + if [ ! -d ${DBDIR} ] + then + echo "Creating \"${DBDIR}\"." + mkdir ${DBDIR} + chown ${USER}:${GROUP} ${DBDIR} + fi + else + echo "Adding user \"${USER}\" failed..." + exit 1 + fi +fi +exit 0 diff --git a/databases/mongodb/pkg-plist b/databases/mongodb/pkg-plist new file mode 100644 index 000000000000..175a316458e2 --- /dev/null +++ b/databases/mongodb/pkg-plist @@ -0,0 +1,12 @@ +@unexec if [ ! -s %D/etc/mongodb.conf ]; then /bin/rm -f %D/etc/mongodb.conf; fi +bin/mongo +bin/mongod +bin/mongodump +bin/mongoexport +bin/mongofiles +bin/mongoimportjson +bin/mongorestore +bin/mongos +bin/mongosniff +lib/libmongoclient.a +@exec if [ ! -f %D/etc/mongodb.conf ]; then /usr/bin/touch %D/etc/mongodb.conf; fi