summaryrefslogtreecommitdiff
path: root/community/mongodb
diff options
context:
space:
mode:
Diffstat (limited to 'community/mongodb')
-rw-r--r--community/mongodb/PKGBUILD54
-rw-r--r--community/mongodb/mongodb.conf6
-rwxr-xr-xcommunity/mongodb/mongodb.install31
-rwxr-xr-xcommunity/mongodb/mongodb.rc39
4 files changed, 130 insertions, 0 deletions
diff --git a/community/mongodb/PKGBUILD b/community/mongodb/PKGBUILD
new file mode 100644
index 000000000..f295aee1c
--- /dev/null
+++ b/community/mongodb/PKGBUILD
@@ -0,0 +1,54 @@
+# Maintainer: Thomas Dziedzic < gostrc at gmail >
+# Contributor: Mathias Stearn <mathias@10gen.com>
+# Contributor: Alec Thomas
+
+pkgname=mongodb
+pkgver=1.8.0
+pkgrel=2
+pkgdesc='A high-performance, open source, schema-free document-oriented database.'
+arch=('i686' 'x86_64')
+url='http://www.mongodb.org'
+license=('AGPL3')
+depends=('boost-libs' 'spidermonkey' 'pcre')
+makedepends=('scons' 'boost')
+optdepends=('libpcap: needed for mongosniff')
+backup=('etc/mongodb.conf')
+install="mongodb.install"
+source=("http://downloads.mongodb.org/src/mongodb-src-r${pkgver}.tar.gz"
+ 'mongodb.rc'
+ 'mongodb.conf')
+md5sums=('243b2776cbe8c70b3bbc402c855f4e82'
+ '859f8f9bb32ef2bd21fec55ae9a87d0a'
+ '9e0ea3f96732bb7811f0b64dace56440')
+
+build() {
+ export SCONSFLAGS="$MAKEFLAGS"
+
+ cd ${pkgname}-src-r${pkgver}
+
+ # scons is "special"
+ sed -i 's/-Wall -Wsign-compare/& -DBOOST_FILESYSTEM_VERSION=2/' SConstruct
+
+ scons \
+ all \
+ --full
+}
+
+package() {
+ cd ${pkgname}-src-r${pkgver}
+
+ scons \
+ install \
+ --full \
+ --prefix=${pkgdir}/usr
+
+ install -D -m755 ${srcdir}/mongodb.rc \
+ ${pkgdir}/etc/rc.d/mongodb
+ install -D -m644 ${srcdir}/mongodb.conf \
+ ${pkgdir}/etc/mongodb.conf
+ install -d -m700 ${pkgdir}/var/state/mongodb
+
+ if [ -d ${pkgdir}/usr/lib64 ]; then
+ mv ${pkgdir}/usr/lib64 ${pkgdir}/usr/lib
+ fi
+}
diff --git a/community/mongodb/mongodb.conf b/community/mongodb/mongodb.conf
new file mode 100644
index 000000000..60d73eae8
--- /dev/null
+++ b/community/mongodb/mongodb.conf
@@ -0,0 +1,6 @@
+# See http://www.mongodb.org/display/DOCS/File+Based+Configuration for format details
+# Run mongod --help to see a list of options
+
+bind_ip = 127.0.0.1
+quiet = true
+dbpath = /var/state/mongodb
diff --git a/community/mongodb/mongodb.install b/community/mongodb/mongodb.install
new file mode 100755
index 000000000..152f36515
--- /dev/null
+++ b/community/mongodb/mongodb.install
@@ -0,0 +1,31 @@
+# vim: syntax=sh
+
+show_msg(){
+ if [ "$(arch)" != "x86_64" ]
+ then
+ cat <<END
+###########################################################################
+# Warning: the 32 bit version of MongoDB is limited to about 2GB of data. #
+# See http://blog.mongodb.org/post/137788967/32-bit-limitations #
+###########################################################################
+END
+ fi
+}
+
+post_install() {
+ useradd -r -g daemon -d /var/state/mongodb -s /bin/false mongodb
+ chown -R mongodb:daemon /var/state/mongodb
+
+ show_msg
+}
+
+post_upgrade() {
+ chown -R mongodb:daemon /var/state/mongodb
+
+ show_msg
+}
+
+pre_remove() {
+ /etc/rc.d/mongodb stop
+ userdel mongodb
+}
diff --git a/community/mongodb/mongodb.rc b/community/mongodb/mongodb.rc
new file mode 100755
index 000000000..b808a2fb0
--- /dev/null
+++ b/community/mongodb/mongodb.rc
@@ -0,0 +1,39 @@
+#!/bin/bash
+# vim: syntax=sh
+
+. /etc/rc.conf
+. /etc/rc.d/functions
+
+PID=`pidof /usr/bin/mongod`
+case "$1" in
+ start)
+ stat_busy "Starting mongodb"
+ [ -z "$PID" ] && /bin/su mongodb -s /bin/bash -c "/usr/bin/mongod --config /etc/mongodb.conf &" > /var/log/mongod 2>&1
+ if [ $? -gt 0 ]; then
+ stat_fail
+ else
+ add_daemon mongodb
+ stat_done
+ fi
+ ;;
+ stop)
+ stat_busy "Stopping mongodb"
+ [ ! -z "$PID" ] && kill $PID &> /dev/null
+ if [ $? -gt 0 ]; then
+ stat_fail
+ else
+ rm_daemon mongodb
+ while [ ! -z "$(pidof /usr/bin/mongod)" ]; do
+ sleep 1;
+ done
+ stat_done
+ fi
+ ;;
+ restart)
+ $0 stop
+ $0 start
+ ;;
+ *)
+ echo "usage: $0 {start|stop|restart}"
+esac
+exit 0