freebsd-ports/databases/mongodb-devel/pkg-install
Wen Heping 51ed5eda72 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/

PR:		ports/140257 [1]
		ports/140144 [2]
		ports/140489 [2]
Submitted by:	Ivan Voras <ivoras@FreeBSD.org> [1]
		Mirko Zinn <mail@derzinn.de> [2]
2009-11-19 07:09:00 +00:00

43 lines
777 B
Bash

#!/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