summaryrefslogtreecommitdiff
path: root/buildscripts/packager.py
diff options
context:
space:
mode:
authorSam Kleinman <samk@10gen.com>2016-10-11 20:14:31 -0400
committerSam Kleinman <samk@10gen.com>2016-10-25 11:59:21 -0400
commit00aed802dd912f39f842a59e9df36eb3792b77a6 (patch)
treef9d8c215a016b3fb94b563ed9ea9a6d16ece6a9f /buildscripts/packager.py
parent1e6fe6df6941e97c73db086e6ec7ebb24bc7dec9 (diff)
downloadmongo-00aed802dd912f39f842a59e9df36eb3792b77a6.tar.gz
SERVER-25368: add native systemd support for rhel7 and suse12
Diffstat (limited to 'buildscripts/packager.py')
-rwxr-xr-xbuildscripts/packager.py23
1 files changed, 20 insertions, 3 deletions
diff --git a/buildscripts/packager.py b/buildscripts/packager.py
index 97c3a95f275..43e411114f3 100755
--- a/buildscripts/packager.py
+++ b/buildscripts/packager.py
@@ -646,13 +646,30 @@ def make_rpm(distro, build_os, arch, spec, srcdir):
suffix=spec.suffix()
sdir=setupdir(distro, build_os, arch, spec)
- # Use special suse init script if we're building for SUSE
+ specfile = srcdir + "rpm/mongodb%s.spec" % suffix
+
+ # The Debian directory is here for the manpages so we we need to remove the service file
+ # from it so that RPM packages don't end up with the Debian file.
+ os.unlink(sdir + "debian/mongod.service")
+
+ # Swap out systemd files, different systemd spec files, and init scripts as needed based on
+ # underlying os version. Arranged so that new distros moving forward automatically use
+ # systemd. Note: the SUSE init packages use a different init script than then other RPM
+ # distros.
#
- if distro.name() == "suse":
+ if distro.name() == "suse" and distro.repo_os_version(build_os) in ("10", "11"):
os.unlink(sdir+"rpm/init.d-mongod")
os.link(sdir+"rpm/init.d-mongod.suse", sdir+"rpm/init.d-mongod")
- specfile=srcdir+"rpm/mongodb%s.spec" % suffix
+ os.unlink(specfile)
+ os.link(specfile.replace(".spec", "-init.spec"), specfile)
+ elif distro.name() == "rhel" and distro.repo_os_version(build_os) in ("5", "6"):
+ os.unlink(specfile)
+ os.link(specfile.replace(".spec", "-init.spec"), specfile)
+ elif distro.name() == "amazon":
+ os.unlink(specfile)
+ os.link(specfile.replace(".spec", "-init.spec"), specfile)
+
topdir=ensure_dir('%s/rpmbuild/%s/' % (os.getcwd(), build_os))
for subdir in ["BUILD", "RPMS", "SOURCES", "SPECS", "SRPMS"]:
ensure_dir("%s/%s/" % (topdir, subdir))