Browse code

Add MongoDB support

Change-Id: Ic6f0c7d647abf54bb12835d1a96589352baa78d9
Reviewed-on: http://photon-jenkins.eng.vmware.com:8082/4901
Reviewed-by: Anish Swaminathan <anishs@vmware.com>
Tested-by: Anish Swaminathan <anishs@vmware.com>

DheerajSShetty authored on 2018/03/17 05:37:11
Showing 1 changed files
1 1
new file mode 100644
... ...
@@ -0,0 +1,68 @@
0
+Name:           mongodb
1
+Version:        3.4.10
2
+Release:        1%{?dist}
3
+Summary:        The MongoDB Database
4
+Group:          Applications/Database
5
+License:        AGPLv3
6
+URL:            http://www.mongodb.org/
7
+Source0:        https://github.com/mongodb/mongo/archive/mongo-r%{version}.tar.gz
8
+%define sha1    mongo-r=39b1e86c650a7b1b3ccc1dee86d088fc95a0a225
9
+Vendor:         VMware, Inc.
10
+Distribution:   Photon
11
+BuildRequires:  scons
12
+BuildRequires:  systemd
13
+
14
+%description
15
+MongoDB (from "humongous") is a scalable, high-performance, open source, document-oriented database.
16
+
17
+%prep
18
+%setup -qn mongo-r%{version}
19
+
20
+%build
21
+scons %{?_smp_mflags} MONGO_VERSION=%{version} \
22
+    --disable-warnings-as-errors
23
+
24
+%install
25
+scons %{?_smp_mflags} MONGO_VERSION=%{version} install \
26
+    --prefix=%{buildroot}%{_prefix} \
27
+    --disable-warnings-as-errors
28
+install -d %{buildroot}/var/log/%{name}
29
+install -d %{buildroot}/var/lib/mongo
30
+install -d -m 755 %{buildroot}%{_unitdir}
31
+install -D -m 644 rpm/mongod.service %{buildroot}%{_unitdir}
32
+install -D -m 644 rpm/mongod.conf %{buildroot}/etc/mongod.conf
33
+
34
+
35
+%clean
36
+rm -rf %{buildroot}
37
+
38
+# Pre-install
39
+%pre
40
+if ! getent group mongod >/dev/null; then
41
+    /sbin/groupadd -r mongod
42
+fi
43
+if ! getent passwd mongod >/dev/null; then
44
+    /sbin/useradd -g mongod mongod -s /sbin/nologin
45
+fi
46
+
47
+%preun
48
+    %systemd_preun mongod.service
49
+
50
+%postun
51
+    %systemd_postun_with_restart mongod.service
52
+
53
+%post
54
+    %systemd_post mongod.service
55
+
56
+
57
+%files
58
+%defattr(-,root,root,-)
59
+%{_bindir}/*
60
+%{_unitdir}/mongod.service
61
+%config(noreplace) %attr(0644, mongod, mongod) %{_sysconfdir}/mongod.conf
62
+%attr(0766, mongod, mongod) %dir /var/log/%{name}
63
+%attr(0766, mongod, mongod) %dir /var/lib/mongo
64
+
65
+%changelog
66
+*   Fri Mar 16 2018 Dheeraj Shetty <dheerajs@vmware.com> 3.4.10-1
67
+-   Initial build.  First version