5a41478789
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
64 lines
2.2 KiB
Bash
64 lines
2.2 KiB
Bash
#!/bin/sh
|
|
# postinst script for memgraph
|
|
#
|
|
# see: dh_installdeb(1)
|
|
|
|
set -e
|
|
|
|
# summary of how this script can be called:
|
|
# * <postinst> `configure' <most-recently-configured-version>
|
|
# * <old-postinst> `abort-upgrade' <new version>
|
|
# * <conflictor's-postinst> `abort-remove' `in-favour' <package>
|
|
# <new-version>
|
|
# * <postinst> `abort-remove'
|
|
# * <deconfigured's-postinst> `abort-deconfigure' `in-favour'
|
|
# <failed-install-package> <version> `removing'
|
|
# <conflicting-package> <version>
|
|
# for details, see https://www.debian.org/doc/debian-policy/ or
|
|
# the debian-policy package
|
|
|
|
case "$1" in
|
|
configure)
|
|
# Add the 'memgraph' user and group and set permissions on
|
|
# 'var/*/memgraph' directories.
|
|
adduser --quiet --system --group --no-create-home --shell /bin/bash memgraph || exit 1
|
|
echo "Don't forget to switch to the 'memgraph' user to use Memgraph" || exit 1
|
|
chown memgraph:memgraph /var/lib/memgraph || exit 1
|
|
chmod 750 /var/lib/memgraph || exit 1
|
|
chown memgraph:adm /var/log/memgraph || exit 1
|
|
chmod 750 /var/log/memgraph || exit 1
|
|
;;
|
|
|
|
abort-upgrade|abort-remove|abort-deconfigure)
|
|
;;
|
|
|
|
*)
|
|
echo "postinst called with unknown argument \`$1'" >&2
|
|
exit 1
|
|
;;
|
|
esac
|
|
|
|
# Always setup the systemd memgraph.service. The following was autogenerated
|
|
# by dh_systemd_enable and dh_systemd_start, so it should behave as expected.
|
|
|
|
# This will only remove masks created by d-s-h on package removal.
|
|
deb-systemd-helper unmask memgraph.service >/dev/null || true
|
|
|
|
# was-enabled defaults to true, so new installations run enable.
|
|
if deb-systemd-helper --quiet was-enabled memgraph.service; then
|
|
# Enables the unit on first installation, creates new
|
|
# symlinks on upgrades if the unit file has changed.
|
|
deb-systemd-helper enable memgraph.service >/dev/null || true
|
|
else
|
|
# Update the statefile to add new symlinks (if any), which need to be
|
|
# cleaned up on purge. Also remove old symlinks.
|
|
deb-systemd-helper update-state memgraph.service >/dev/null || true
|
|
fi
|
|
|
|
if [ -d /run/systemd/system ]; then
|
|
systemctl --system daemon-reload >/dev/null || true
|
|
deb-systemd-invoke start memgraph.service >/dev/null || true
|
|
fi
|
|
|
|
exit 0
|