Skip to content

Commit e1f5934

Browse files
Add packaging scripts for Percona MongoLink (#85)
Co-authored-by: Inel Pandzic <[email protected]>
1 parent 290d44f commit e1f5934

File tree

13 files changed

+696
-0
lines changed

13 files changed

+696
-0
lines changed
Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
PML_SOURCE_URI="mongodb://127.0.0.1:27017"
2+
PML_TARGET_URI="mongodb://127.0.0.1:28017"
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
[Unit]
2+
Description=percona-mongolink
3+
After=time-sync.target network.target
4+
5+
[Service]
6+
EnvironmentFile=/etc/sysconfig/percona-mongolink
7+
Type=simple
8+
User=mongod
9+
Group=mongod
10+
PermissionsStartOnly=true
11+
ExecStart=/usr/bin/percona-mongolink
12+
13+
[Install]
14+
WantedBy=multi-user.target

packaging/debian/compat

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
9

packaging/debian/control

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
Source: percona-mongolink
2+
Section: utils
3+
Priority: optional
4+
Maintainer: Percona LLC
5+
Version: %{version}
6+
Homepage: https://percona.com
7+
8+
Package: percona-mongolink
9+
Architecture: any
10+
Description: Percona MongoLink is a tool for replicating data from a source MongoDB cluster to a target MongoDB cluster. It supports cloning data, replicating changes, and managing collections and indexes.

packaging/debian/install

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
percona-mongolink /usr/bin/
2+
default/percona-mongolink /etc/default/
3+
percona-mongolink.service /lib/systemd/system/
4+
LICENSE /usr/share/doc/percona-mongolink/

packaging/debian/postinst

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
#!/bin/sh
2+
3+
#DEBHELPER#
4+
cat << EOF
5+
** Join Percona Squad! **
6+
7+
Participate in monthly SWAG raffles, get early access to new product features,
8+
invite-only ”ask me anything” sessions with database performance experts.
9+
10+
Interested? Fill in the form at https://squad.percona.com/mongodb
11+
12+
EOF
13+
14+
exit 0

packaging/debian/postrm

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
#!/bin/bash
2+
3+
set -e
4+
5+
if [ -f /usr/share/debconf/confmodule ]; then
6+
. /usr/share/debconf/confmodule
7+
fi
8+
9+
case "$1" in
10+
11+
purge | remove | upgrade | failed-upgrade | abort-install | abort-upgrade | disappear) ;;
12+
13+
*)
14+
echo "postrm called with unknown argument '$1'" 1>&2
15+
exit 1
16+
;;
17+
18+
esac
19+
20+
#DEBHELPER#
21+
22+
exit 0

packaging/debian/preinst

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
#!/bin/sh
2+
3+
if ! getent passwd mongod >/dev/null 2>&1; then
4+
adduser --system --no-create-home --group mongod
5+
fi
6+
7+
if [ ! -f /var/log/percona-mongolink.log ]; then
8+
install -m 0755 -omongod -gmongod /dev/null /var/log/percona-mongolink.log
9+
fi
10+
11+
#DEBHELPER#
12+
13+
exit 0

packaging/debian/prerm

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
#!/bin/bash
2+
3+
set -e
4+
5+
#DEBHELPER#
6+
7+
set +e
8+
9+
exit 0

packaging/debian/rules

Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
#!/usr/bin/make -f
2+
# -*- makefile -*-
3+
# Sample debian/rules that uses debhelper.
4+
# This file was originally written by Joey Hess and Craig Small.
5+
# As a special exception, when this file is copied by dh-make into a
6+
# dh-make output file, you may use that output file without restriction.
7+
# This special exception was added by Craig Small in version 0.37 of dh-make.
8+
PHONY: override_dh_auto_build override_dh_auto_install
9+
# Uncomment this to turn on verbose mode.
10+
#export DH_VERBOSE=1
11+
export DH_VERBOSE=1
12+
13+
TMP=$(CURDIR)/debian/tmp/
14+
15+
export VERSION=$(shell egrep '^VERSION' VERSION | cut -f 2 -d '=')
16+
export GITBRANCH=$(shell egrep '^GITBRANCH' VERSION | cut -f 2 -d '=')
17+
export GITCOMMIT=$(shell egrep '^GITCOMMIT' VERSION | cut -f 2 -d '=')
18+
export COMPONENT_VERSION=$(shell egrep '^COMPONENT_VERSION' VERSION | cut -f 2 -d '=')
19+
20+
%:
21+
dh $@ --with-systemd
22+
23+
override_dh_auto_clean:
24+
# Skip upstream make clean completely
25+
26+
override_dh_builddeb:
27+
dh_builddeb -- -Zgzip
28+
29+
override_dh_auto_test override_dh_compress override_dh_fixperms override_dh_strip:
30+
31+
override_dh_auto_build:
32+
@echo "RULES.$@"
33+
export PATH=/usr/local/go/bin:${PATH}
34+
export GOROOT="/usr/local/go/"
35+
export GOPATH=${PWD}/build
36+
export PATH="/usr/local/go/bin:${PATH}:${GOPATH}"
37+
export GOBINPATH="/usr/local/go/bin"
38+
mkdir -p build/src/github.com/percona/percona-mongolink
39+
cp -r `ls | grep -v build` build/src/github.com/percona/percona-mongolink/
40+
cd build/src/github.com/percona/percona-mongolink/ && make build
41+
touch $@
42+
43+
override_dh_auto_install:
44+
@echo "RULES.$@"
45+
mkdir -p $(TMP)
46+
mkdir -p $(TMP)/default
47+
cd build/src/github.com/percona/percona-mongolink/bin && cp percona-mongolink $(TMP)/percona-mongolink
48+
cp -f packaging/conf/percona-mongolink.env $(TMP)/default/percona-mongolink
49+
cp -f packaging/conf/percona-mongolink.service $(TMP)/percona-mongolink.service
50+
cp -f LICENSE $(TMP)/LICENSE
51+
ls -la $(TMP)
52+
53+
override_dh_systemd_start:
54+
dh_systemd_enable --name=percona-mongolink percona-mongolink.service
55+
dh_systemd_start --restart-after-upgrade

0 commit comments

Comments
 (0)