summaryrefslogtreecommitdiff
path: root/rpm/mongo.spec
diff options
context:
space:
mode:
authorRichard Kreuter <richard@10gen.com>2010-04-02 16:25:31 -0400
committerRichard Kreuter <richard@10gen.com>2010-04-02 16:25:31 -0400
commite29eacd7986fcefe2195a1705b62e3969a6fae79 (patch)
treeffd21b9f7f8bab5a34345149cf5e24cfa8f179ad /rpm/mongo.spec
parent72ad34e3f01dfb3dcba45dad784355c297feadb8 (diff)
downloadmongo-e29eacd7986fcefe2195a1705b62e3969a6fae79.tar.gz
Conditionalize useradd/groupadd in rpm/mongo.spec.
Diffstat (limited to 'rpm/mongo.spec')
-rw-r--r--rpm/mongo.spec10
1 files changed, 7 insertions, 3 deletions
diff --git a/rpm/mongo.spec b/rpm/mongo.spec
index cf32996b57a..8e2753815b4 100644
--- a/rpm/mongo.spec
+++ b/rpm/mongo.spec
@@ -68,9 +68,13 @@ scons -c
rm -rf $RPM_BUILD_ROOT
%pre server
-/usr/sbin/groupadd -r mongod
-/usr/sbin/useradd -M -r -g mongod -d /var/lib/mongo -s /bin/false \
- -c mongod mongod > /dev/null 2>&1
+if ! /usr/bin/id -g mongod &>/dev/null; then
+ /usr/sbin/groupadd -r mongod
+fi
+if ! /usr/bin/id mongod &>/dev/null; then
+ /usr/sbin/useradd -M -r -g mongod -d /var/lib/mongo -s /bin/false \
+ -c mongod mongod > /dev/null 2>&1
+fi
%post server
if test $1 = 1