memgraph/cmake/debian/postrm
Teon Banek 5a41478789 Add maintainer scripts for DEB package
Summary:
Add postinst script for DEB package

The script creates a 'memgraph' group and sets permission on installed
'/var/*/memgraph' directories. Only the group is created, while
'memgraph' user is not. It seems more sane only to require group
membership for using memgraph.

Add conffiles for DEB package

This allows for `dpkg` to detect changes in configuration files and
present them to the user. Therefore, we don't need to care whether the
configuration merges are handled correctly nor if we accidentally
overwrite them.

Add postrm script for DEB packaging

The script is only used so that `dpkg --purge` removes '/var/*/memgraph'
directories, even if they contain something.

Add email, longer description and license file to DEB packaging, as well
as a systemd service.

Provide a logrotate configuration and support it in memgraph.

Use DEB package for Docker installation

This way, the whole installation process and testing should go through
DEB.

Generate release archives in Apollo with standard names

Reviewers: buda, mferencevic

Reviewed By: mferencevic

Subscribers: pullbot

Differential Revision: https://phabricator.memgraph.io/D989
2017-11-22 16:41:25 +01:00

65 lines
1.8 KiB
Bash

#!/bin/sh
# postrm script for memgraph
#
# see: dh_installdeb(1)
set -e
# summary of how this script can be called:
# * <postrm> `remove'
# * <postrm> `purge'
# * <old-postrm> `upgrade' <new-version>
# * <new-postrm> `failed-upgrade' <old-version>
# * <new-postrm> `abort-install'
# * <new-postrm> `abort-install' <old-version>
# * <new-postrm> `abort-upgrade' <old-version>
# * <disappearer's-postrm> `disappear' <overwriter>
# <overwriter-version>
# for details, see https://www.debian.org/doc/debian-policy/ or
# the debian-policy package
var_files="/var/lib/memgraph /var/log/memgraph"
case "$1" in
purge)
# Remove 'var/*/memgraph' directories, even if they contain something.
for var_file in $var_files; do
rm -rf $var_file
done
# Don't remove the 'memgraph' user, since we cannot be sure whether it
# existed before.
;;
remove|upgrade|failed-upgrade|abort-install|abort-upgrade|disappear)
# Default behaviour does what we expect, removes untouched installed
# files but keeps configuration.
;;
*)
echo "postrm called with unknown argument \`$1'" >&2
exit 1
;;
esac
# Remove and purge systemd memgraph.service. The following was autogenerated
# by dh_systemd_enable and dh_systemd_start.
if [ -d /run/systemd/system ]; then
systemctl --system daemon-reload >/dev/null || true
fi
if [ "$1" = "remove" ]; then
if [ -x "/usr/bin/deb-systemd-helper" ]; then
deb-systemd-helper mask memgraph.service >/dev/null
fi
fi
if [ "$1" = "purge" ]; then
if [ -x "/usr/bin/deb-systemd-helper" ]; then
deb-systemd-helper purge memgraph.service >/dev/null
deb-systemd-helper unmask memgraph.service >/dev/null
fi
fi
exit 0