summaryrefslogtreecommitdiff
path: root/community-staging/mongodb
diff options
context:
space:
mode:
authorroot <root@rshg054.dnsready.net>2012-07-12 00:04:35 +0000
committerroot <root@rshg054.dnsready.net>2012-07-12 00:04:35 +0000
commit00d32b0938eebfa45f0543cae655abf5233eb99c (patch)
tree7528e734c1f6f955da0baca5909906e797562c09 /community-staging/mongodb
parentb44e3e7f16abe5e4cb428571db65d300b7cc44be (diff)
Thu Jul 12 00:04:34 UTC 2012
Diffstat (limited to 'community-staging/mongodb')
-rw-r--r--community-staging/mongodb/0001-Backport-for-mongodb-2.0.4-Ignore-fork-and-logpath-w.patch38
-rw-r--r--community-staging/mongodb/0002-Backport-for-mongodb-2.0.4-Don-t-check-proc-pid-exe-.patch43
-rw-r--r--community-staging/mongodb/PKGBUILD73
-rw-r--r--community-staging/mongodb/boost-1.50.patch245
-rw-r--r--community-staging/mongodb/mongodb.conf8
-rw-r--r--community-staging/mongodb/mongodb.install32
-rw-r--r--community-staging/mongodb/mongodb.rc39
7 files changed, 478 insertions, 0 deletions
diff --git a/community-staging/mongodb/0001-Backport-for-mongodb-2.0.4-Ignore-fork-and-logpath-w.patch b/community-staging/mongodb/0001-Backport-for-mongodb-2.0.4-Ignore-fork-and-logpath-w.patch
new file mode 100644
index 000000000..40dd48b42
--- /dev/null
+++ b/community-staging/mongodb/0001-Backport-for-mongodb-2.0.4-Ignore-fork-and-logpath-w.patch
@@ -0,0 +1,38 @@
+From 3f6b2390102ea9d808c7075b5aaeec743b7d104e Mon Sep 17 00:00:00 2001
+From: Thomas Dziedzic <gostrc@gmail.com>
+Date: Tue, 10 Apr 2012 19:30:35 -0500
+Subject: [PATCH 1/2] Backport for mongodb 2.0.4 "Ignore --fork and --logpath
+ when using --shutdown SERVER-5186 SERVER-5187"
+
+https://github.com/mongodb/mongo/commit/fa2e2ef95c5c934eef63fff4b98d5eb060c5653923
+
+Backported in preparation for backporting the fix for https://jira.mongodb.org/browse/SERVER-5358
+---
+ db/cmdline.cpp | 4 ++--
+ 1 file changed, 2 insertions(+), 2 deletions(-)
+
+diff --git a/db/cmdline.cpp b/db/cmdline.cpp
+index fd759a7..346a9ae 100644
+--- a/db/cmdline.cpp
++++ b/db/cmdline.cpp
+@@ -239,7 +239,7 @@ namespace mongo {
+ cmdLine.noUnixSocket = true;
+ }
+
+- if (params.count("fork")) {
++ if (params.count("fork") && !params.count("shutdown")) {
+ if ( ! params.count( "logpath" ) ) {
+ cout << "--fork has to be used with --logpath" << endl;
+ ::exit(-1);
+@@ -304,7 +304,7 @@ namespace mongo {
+ }
+
+ #endif
+- if (params.count("logpath")) {
++ if (params.count("logpath") && !params.count("shutdown")) {
+ if ( logpath.size() == 0 )
+ logpath = params["logpath"].as<string>();
+ uassert( 10033 , "logpath has to be non-zero" , logpath.size() );
+--
+1.7.10
+
diff --git a/community-staging/mongodb/0002-Backport-for-mongodb-2.0.4-Don-t-check-proc-pid-exe-.patch b/community-staging/mongodb/0002-Backport-for-mongodb-2.0.4-Don-t-check-proc-pid-exe-.patch
new file mode 100644
index 000000000..aff066450
--- /dev/null
+++ b/community-staging/mongodb/0002-Backport-for-mongodb-2.0.4-Don-t-check-proc-pid-exe-.patch
@@ -0,0 +1,43 @@
+From 77f78f64c192572e6eb956b0fe28ecd975ff6461 Mon Sep 17 00:00:00 2001
+From: Thomas Dziedzic <gostrc@gmail.com>
+Date: Tue, 10 Apr 2012 19:38:58 -0500
+Subject: [PATCH 2/2] Backport for mongodb 2.0.4 "Don't check /proc/pid/exe in
+ --shutdown SERVER-5358"
+
+Backported to fix https://jira.mongodb.org/browse/SERVER-5358
+
+https://github.com/mongodb/mongo/commit/c28d97d1a14a36ffc056bfd9ba7262b0a1509b5b
+---
+ db/db.cpp | 16 ----------------
+ 1 file changed, 16 deletions(-)
+
+diff --git a/db/db.cpp b/db/db.cpp
+index b1d1db8..0a21f4d 100644
+--- a/db/db.cpp
++++ b/db/db.cpp
+@@ -989,22 +989,6 @@ int main(int argc, char* argv[]) {
+ procPath = (str::stream() << "/proc/" << pid);
+ if (!boost::filesystem::exists(procPath))
+ failed = true;
+-
+- string exePath = procPath + "/exe";
+- if (boost::filesystem::exists(exePath)){
+- char buf[256];
+- int ret = readlink(exePath.c_str(), buf, sizeof(buf)-1);
+- buf[ret] = '\0'; // readlink doesn't terminate string
+- if (ret == -1) {
+- int e = errno;
+- cerr << "Error resolving " << exePath << ": " << errnoWithDescription(e);
+- failed = true;
+- }
+- else if (!endsWith(buf, "mongod")){
+- cerr << "Process " << pid << " is running " << buf << " not mongod" << endl;
+- ::exit(-1);
+- }
+- }
+ }
+ catch (const std::exception& e){
+ cerr << "Error reading pid from lock file [" << name << "]: " << e.what() << endl;
+--
+1.7.10
+
diff --git a/community-staging/mongodb/PKGBUILD b/community-staging/mongodb/PKGBUILD
new file mode 100644
index 000000000..455b73938
--- /dev/null
+++ b/community-staging/mongodb/PKGBUILD
@@ -0,0 +1,73 @@
+# $Id: PKGBUILD 73593 2012-07-11 01:17:31Z svenstaro $
+# Maintainer: Sven-Hendrik Haase <sh@lutzhaase.com>
+# Contributor: Thomas Dziedzic < gostrc at gmail >
+# Contributor: Mathias Stearn <mathias@10gen.com>
+# Contributor: Alec Thomas
+
+pkgname=mongodb
+pkgver=2.0.6
+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')
+makedepends=('scons' 'boost')
+#checkdepends=('python2-pymongo')
+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'
+ 'boost-1.50.patch')
+md5sums=('b3b32fecdcbe8e8068ec2989be9d2da4'
+ '9c67e00f4626ad761a8f7d4e037a54d7'
+ '4839fe1d638187ca3226e8267b947318'
+ '5d22fd2c0ae869218488cd7c0dbc3903')
+
+build() {
+ export SCONSFLAGS="$MAKEFLAGS"
+
+ cd mongodb-src-r${pkgver}
+
+ patch -Np1 -i ${srcdir}/boost-1.50.patch
+
+ scons \
+ all \
+ --full
+}
+
+<<COMMENT
+check() {
+ export SCONSFLAGS="$MAKEFLAGS"
+
+ cd mongodb-src-r${pkgver}
+
+ scons \
+ smokeAll \
+ --smokedbprefix=${srcdir}
+}
+COMMENT
+
+package() {
+ export SCONSFLAGS="$MAKEFLAGS"
+
+ cd mongodb-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/lib/mongodb
+ install -d -m755 ${pkgdir}/var/log/mongodb
+
+ if [ -d ${pkgdir}/usr/lib64 ]; then
+ mv ${pkgdir}/usr/lib64 ${pkgdir}/usr/lib
+ fi
+}
diff --git a/community-staging/mongodb/boost-1.50.patch b/community-staging/mongodb/boost-1.50.patch
new file mode 100644
index 000000000..4ccb898ec
--- /dev/null
+++ b/community-staging/mongodb/boost-1.50.patch
@@ -0,0 +1,245 @@
+diff -ru '--exclude=mongo_vstudio.cpp' mongodb-src-r2.0.6/db/db.cpp mongodb-src-r2.0.6-patched/db/db.cpp
+--- mongodb-src-r2.0.6/db/db.cpp 2012-06-04 15:42:54.000000000 +0200
++++ mongodb-src-r2.0.6-patched/db/db.cpp 2012-07-10 22:27:16.496886220 +0200
+@@ -326,7 +326,7 @@
+ boost::filesystem::path path( dbpath );
+ for ( boost::filesystem::directory_iterator i( path );
+ i != boost::filesystem::directory_iterator(); ++i ) {
+- string fileName = boost::filesystem::path(*i).leaf();
++ string fileName = boost::filesystem::path(*i).leaf().string();
+ if ( boost::filesystem::is_directory( *i ) &&
+ fileName.length() && fileName[ 0 ] == '$' )
+ boost::filesystem::remove_all( *i );
+@@ -655,11 +655,6 @@
+ dbExecCommand = argv[0];
+
+ srand(curTimeMicros());
+-#if( BOOST_VERSION >= 104500 )
+- boost::filesystem::path::default_name_check( boost::filesystem2::no_check );
+-#else
+- boost::filesystem::path::default_name_check( boost::filesystem::no_check );
+-#endif
+
+ {
+ unsigned x = 0x12345678;
+@@ -976,7 +971,7 @@
+ if (params.count("shutdown")){
+ bool failed = false;
+
+- string name = ( boost::filesystem::path( dbpath ) / "mongod.lock" ).native_file_string();
++ string name = ( boost::filesystem::path( dbpath ) / "mongod.lock" ).string();
+ if ( !boost::filesystem::exists( name ) || boost::filesystem::file_size( name ) == 0 )
+ failed = true;
+
+diff -ru '--exclude=mongo_vstudio.cpp' mongodb-src-r2.0.6/db/dur.cpp mongodb-src-r2.0.6-patched/db/dur.cpp
+--- mongodb-src-r2.0.6/db/dur.cpp 2012-06-04 15:42:54.000000000 +0200
++++ mongodb-src-r2.0.6-patched/db/dur.cpp 2012-07-10 21:56:28.866778732 +0200
+@@ -692,7 +692,7 @@
+
+ bool samePartition = true;
+ try {
+- const string dbpathDir = boost::filesystem::path(dbpath).native_directory_string();
++ const string dbpathDir = boost::filesystem::path(dbpath).string();
+ samePartition = onSamePartition(getJournalDir().string(), dbpathDir);
+ }
+ catch(...) {
+diff -ru '--exclude=mongo_vstudio.cpp' mongodb-src-r2.0.6/db/dur_journal.cpp mongodb-src-r2.0.6-patched/db/dur_journal.cpp
+--- mongodb-src-r2.0.6/db/dur_journal.cpp 2012-06-04 15:42:54.000000000 +0200
++++ mongodb-src-r2.0.6-patched/db/dur_journal.cpp 2012-07-10 22:04:18.583472723 +0200
+@@ -169,7 +169,7 @@
+ for ( boost::filesystem::directory_iterator i( getJournalDir() );
+ i != boost::filesystem::directory_iterator();
+ ++i ) {
+- string fileName = boost::filesystem::path(*i).leaf();
++ string fileName = boost::filesystem::path(*i).leaf().string();
+ if( str::startsWith(fileName, "j._") )
+ return true;
+ }
+@@ -185,7 +185,7 @@
+ for ( boost::filesystem::directory_iterator i( getJournalDir() );
+ i != boost::filesystem::directory_iterator();
+ ++i ) {
+- string fileName = boost::filesystem::path(*i).leaf();
++ string fileName = boost::filesystem::path(*i).leaf().string();
+ if( str::startsWith(fileName, "j._") ) {
+ try {
+ removeOldJournalFile(*i);
+diff -ru '--exclude=mongo_vstudio.cpp' mongodb-src-r2.0.6/db/dur_recover.cpp mongodb-src-r2.0.6-patched/db/dur_recover.cpp
+--- mongodb-src-r2.0.6/db/dur_recover.cpp 2012-06-04 15:42:54.000000000 +0200
++++ mongodb-src-r2.0.6-patched/db/dur_recover.cpp 2012-07-10 22:02:18.226799055 +0200
+@@ -71,7 +71,7 @@
+ i != filesystem::directory_iterator();
+ ++i ) {
+ filesystem::path filepath = *i;
+- string fileName = filesystem::path(*i).leaf();
++ string fileName = filesystem::path(*i).leaf().string();
+ if( str::startsWith(fileName, "j._") ) {
+ unsigned u = str::toUnsigned( str::after(fileName, '_') );
+ if( m.count(u) ) {
+@@ -84,7 +84,7 @@
+ if( i != m.begin() && m.count(i->first - 1) == 0 ) {
+ uasserted(13532,
+ str::stream() << "unexpected file in journal directory " << dir.string()
+- << " : " << filesystem::path(i->second).leaf() << " : can't find its preceeding file");
++ << " : " << filesystem::path(i->second).leaf().string() << " : can't find its preceeding file");
+ }
+ files.push_back(i->second);
+ }
+diff -ru '--exclude=mongo_vstudio.cpp' mongodb-src-r2.0.6/db/instance.cpp mongodb-src-r2.0.6-patched/db/instance.cpp
+--- mongodb-src-r2.0.6/db/instance.cpp 2012-06-04 15:42:54.000000000 +0200
++++ mongodb-src-r2.0.6-patched/db/instance.cpp 2012-07-10 22:08:55.213488817 +0200
+@@ -645,13 +645,13 @@
+ i != boost::filesystem::directory_iterator(); ++i ) {
+ if ( directoryperdb ) {
+ boost::filesystem::path p = *i;
+- string dbName = p.leaf();
++ string dbName = p.leaf().string();
+ p /= ( dbName + ".ns" );
+ if ( MMF::exists( p ) )
+ names.push_back( dbName );
+ }
+ else {
+- string fileName = boost::filesystem::path(*i).leaf();
++ string fileName = boost::filesystem::path(*i).leaf().string();
+ if ( fileName.length() > 3 && fileName.substr( fileName.length() - 3, 3 ) == ".ns" )
+ names.push_back( fileName.substr( 0, fileName.length() - 3 ) );
+ }
+@@ -893,7 +893,7 @@
+ }
+
+ void acquirePathLock(bool doingRepair) {
+- string name = ( boost::filesystem::path( dbpath ) / "mongod.lock" ).native_file_string();
++ string name = ( boost::filesystem::path( dbpath ) / "mongod.lock" ).string();
+
+ bool oldFile = false;
+
+diff -ru '--exclude=mongo_vstudio.cpp' mongodb-src-r2.0.6/db/pdfile.cpp mongodb-src-r2.0.6-patched/db/pdfile.cpp
+--- mongodb-src-r2.0.6/db/pdfile.cpp 2012-06-04 15:42:54.000000000 +0200
++++ mongodb-src-r2.0.6-patched/db/pdfile.cpp 2012-07-10 22:11:44.103498643 +0200
+@@ -1987,7 +1987,7 @@
+ virtual bool apply( const Path &p ) {
+ if ( !boost::filesystem::exists( p ) )
+ return false;
+- boostRenameWrapper( p, newPath_ / ( p.leaf() + ".bak" ) );
++ boostRenameWrapper( p, newPath_ / ( p.leaf().string() + ".bak" ) );
+ return true;
+ }
+ virtual const char * op() const {
+@@ -2093,7 +2093,7 @@
+ uniqueReservedPath( ( preserveClonedFilesOnFailure || backupOriginalFiles ) ?
+ "backup" : "$tmp" );
+ BOOST_CHECK_EXCEPTION( boost::filesystem::create_directory( reservedPath ) );
+- string reservedPathString = reservedPath.native_directory_string();
++ string reservedPathString = reservedPath.string();
+
+ bool res;
+ {
+diff -ru '--exclude=mongo_vstudio.cpp' mongodb-src-r2.0.6/dbtests/framework.cpp mongodb-src-r2.0.6-patched/dbtests/framework.cpp
+--- mongodb-src-r2.0.6/dbtests/framework.cpp 2012-06-04 15:42:54.000000000 +0200
++++ mongodb-src-r2.0.6-patched/dbtests/framework.cpp 2012-07-10 22:29:20.610226773 +0200
+@@ -281,7 +281,7 @@
+ boost::filesystem::create_directory(p);
+ }
+
+- string dbpathString = p.native_directory_string();
++ string dbpathString = p.string();
+ dbpath = dbpathString.c_str();
+
+ cmdLine.prealloc = false;
+diff -ru '--exclude=mongo_vstudio.cpp' mongodb-src-r2.0.6/pch.h mongodb-src-r2.0.6-patched/pch.h
+--- mongodb-src-r2.0.6/pch.h 2012-06-04 15:42:54.000000000 +0200
++++ mongodb-src-r2.0.6-patched/pch.h 2012-07-10 21:35:57.133373738 +0200
+@@ -79,7 +79,7 @@
+ //#include <boost/any.hpp>
+ #include "boost/thread/once.hpp"
+ //#include <boost/archive/iterators/transform_width.hpp>
+-#define BOOST_FILESYSTEM_VERSION 2
++#define BOOST_FILESYSTEM_VERSION 3
+ #include <boost/filesystem/convenience.hpp>
+ #include <boost/filesystem/exception.hpp>
+ #include <boost/filesystem/operations.hpp>
+diff -ru '--exclude=mongo_vstudio.cpp' mongodb-src-r2.0.6/shell/shell_utils.cpp mongodb-src-r2.0.6-patched/shell/shell_utils.cpp
+--- mongodb-src-r2.0.6/shell/shell_utils.cpp 2012-06-04 15:42:54.000000000 +0200
++++ mongodb-src-r2.0.6-patched/shell/shell_utils.cpp 2012-07-10 22:38:58.443593723 +0200
+@@ -388,7 +388,7 @@
+ #endif
+ }
+
+- argv_.push_back( programPath.native_file_string() );
++ argv_.push_back( programPath.string() );
+
+ port_ = -1;
+
+diff -ru '--exclude=mongo_vstudio.cpp' mongodb-src-r2.0.6/tools/restore.cpp mongodb-src-r2.0.6-patched/tools/restore.cpp
+--- mongodb-src-r2.0.6/tools/restore.cpp 2012-06-04 15:42:54.000000000 +0200
++++ mongodb-src-r2.0.6-patched/tools/restore.cpp 2012-07-10 22:45:00.046948094 +0200
+@@ -131,7 +131,7 @@
+ log(2) << "drillDown: " << root.string() << endl;
+
+ // skip hidden files and directories
+- if (root.leaf()[0] == '.' && root.leaf() != ".")
++ if (root.leaf().string()[0] == '.' && root.leaf().string() != ".")
+ return;
+
+ if ( is_directory( root ) ) {
+@@ -210,7 +210,7 @@
+ ns += "." + _coll;
+ }
+ else {
+- string l = root.leaf();
++ string l = root.leaf().string();
+ l = l.substr( 0 , l.find_last_of( "." ) );
+ ns += "." + l;
+ }
+diff -ru '--exclude=mongo_vstudio.cpp' mongodb-src-r2.0.6/tools/tool.cpp mongodb-src-r2.0.6-patched/tools/tool.cpp
+--- mongodb-src-r2.0.6/tools/tool.cpp 2012-06-04 15:42:54.000000000 +0200
++++ mongodb-src-r2.0.6-patched/tools/tool.cpp 2012-07-10 22:23:53.356874403 +0200
+@@ -113,12 +113,6 @@
+ // we want durability to be disabled.
+ cmdLine.dur = false;
+
+-#if( BOOST_VERSION >= 104500 )
+- boost::filesystem::path::default_name_check( boost::filesystem2::no_check );
+-#else
+- boost::filesystem::path::default_name_check( boost::filesystem::no_check );
+-#endif
+-
+ _name = argv[0];
+
+ /* using the same style as db.cpp */
+diff -ru '--exclude=mongo_vstudio.cpp' mongodb-src-r2.0.6/util/background.cpp mongodb-src-r2.0.6-patched/util/background.cpp
+--- mongodb-src-r2.0.6/util/background.cpp 2012-06-04 15:42:54.000000000 +0200
++++ mongodb-src-r2.0.6-patched/util/background.cpp 2012-07-10 21:47:40.420081320 +0200
+@@ -89,7 +89,7 @@
+ if ( msTimeOut ) {
+ // add msTimeOut millisecond to current time
+ boost::xtime xt;
+- boost::xtime_get( &xt, boost::TIME_UTC );
++ boost::xtime_get( &xt, boost::TIME_UTC_ );
+
+ unsigned long long ns = msTimeOut * 1000000ULL; // milli to nano
+ if ( xt.nsec + ns < 1000000000 ) {
+diff -ru '--exclude=mongo_vstudio.cpp' mongodb-src-r2.0.6/util/concurrency/mutex.h mongodb-src-r2.0.6-patched/util/concurrency/mutex.h
+--- mongodb-src-r2.0.6/util/concurrency/mutex.h 2012-06-04 15:42:54.000000000 +0200
++++ mongodb-src-r2.0.6-patched/util/concurrency/mutex.h 2012-07-10 21:45:51.333408307 +0200
+@@ -29,7 +29,7 @@
+
+ inline boost::xtime incxtimemillis( long long s ) {
+ boost::xtime xt;
+- boost::xtime_get(&xt, boost::TIME_UTC);
++ boost::xtime_get(&xt, boost::TIME_UTC_);
+ xt.sec += (int)( s / 1000 );
+ xt.nsec += (int)(( s % 1000 ) * 1000000);
+ if ( xt.nsec >= 1000000000 ) {
+diff -ru '--exclude=mongo_vstudio.cpp' mongodb-src-r2.0.6/util/queue.h mongodb-src-r2.0.6-patched/util/queue.h
+--- mongodb-src-r2.0.6/util/queue.h 2012-06-04 15:42:54.000000000 +0200
++++ mongodb-src-r2.0.6-patched/util/queue.h 2012-07-10 22:14:00.243506560 +0200
+@@ -82,7 +82,7 @@
+ Timer timer;
+
+ boost::xtime xt;
+- boost::xtime_get(&xt, boost::TIME_UTC);
++ boost::xtime_get(&xt, boost::TIME_UTC_);
+ xt.sec += maxSecondsToWait;
+
+ scoped_lock l( _lock );
diff --git a/community-staging/mongodb/mongodb.conf b/community-staging/mongodb/mongodb.conf
new file mode 100644
index 000000000..c5272b7f2
--- /dev/null
+++ b/community-staging/mongodb/mongodb.conf
@@ -0,0 +1,8 @@
+# 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/lib/mongodb
+logpath = /var/log/mongodb/mongod.log
+logappend = true
diff --git a/community-staging/mongodb/mongodb.install b/community-staging/mongodb/mongodb.install
new file mode 100644
index 000000000..2ea94553c
--- /dev/null
+++ b/community-staging/mongodb/mongodb.install
@@ -0,0 +1,32 @@
+# vim: syntax=sh
+
+post_install() {
+ useradd -r -g daemon -d /var/lib/mongodb -s /bin/bash mongodb
+ chown -R mongodb:daemon /var/lib/mongodb
+ chown -R mongodb:daemon /var/log/mongodb
+
+ if [ "$(uname -m)" != "x86_64" ]
+ then
+ echo '==> Warning: the 32 bit version of MongoDB is limited to about 2GB of data.'
+ echo '==> See http://blog.mongodb.org/post/137788967/32-bit-limitations'
+ fi
+}
+
+post_upgrade() {
+ chown -R mongodb:daemon /var/lib/mongodb
+ chown -R mongodb:daemon /var/log/mongodb
+
+ if [ "$(vercmp $2 1.8.2-3)" -lt 0 ]
+ then
+ # have to fix my fudge up in 1.8.2-2 and 1.8.2-3
+ # added july 5th, 2011
+ usermod -s /bin/bash mongodb >& /dev/null
+ echo 'The dbpath has changed from /var/state/mongodb to /var/lib/mongodb'
+ echo 'Make sure you move your data files to the new dbpath before you start/restart mongodb'
+ echo 'The logpath has changed from /var/log/mongod to /var/log/mongodb/mongod.log'
+ fi
+}
+
+pre_remove() {
+ userdel mongodb
+}
diff --git a/community-staging/mongodb/mongodb.rc b/community-staging/mongodb/mongodb.rc
new file mode 100644
index 000000000..30f2bbf79
--- /dev/null
+++ b/community-staging/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 -c "/usr/bin/mongod --config /etc/mongodb.conf --fork" > /dev/null
+ if [ $? -gt 0 ]; then
+ stat_fail
+ else
+ add_daemon mongodb
+ stat_done
+ fi
+ ;;
+ stop)
+ stat_busy "Stopping mongodb"
+ [ ! -z "$PID" ] && /bin/su mongodb -c "/usr/bin/mongod --config /etc/mongodb.conf --shutdown" &> /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