memgraph/release/arch-pkg/memgraph.install
Teon Banek eff843bbcc Tidy up the RPM packaging
Summary:
Use /var/lib/memgraph as home dir for memgraph user.
Merge post and pre RPM scripts in RPM spec file.
Properly handle memgraph.service and directory permissions.

Reviewers: mferencevic

Reviewed By: mferencevic

Subscribers: pullbot

Differential Revision: https://phabricator.memgraph.io/D1350
2018-04-12 10:31:38 +02:00

21 lines
827 B
Plaintext

post_install() {
# Add the 'memgraph' user and group and set permissions on
# 'var/*/memgraph' directories.
getent group memgraph >/dev/null || groupadd -r memgraph || exit 1
getent passwd memgraph >/dev/null || \
useradd -r -g memgraph -d /var/lib/memgraph 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
# Make examples directory immutable (optional)
chattr +i -R /usr/share/memgraph/examples || true
echo "Enable and start 'memgraph.service' to use Memgraph" || exit 1
}
pre_remove() {
# Remove optional immutability from examples directory to allow removal
chattr -i -R /usr/share/memgraph/examples || true
systemctl disable memgraph.service
}