File debian.grommunio-sync.postinst of Package grommunio-sync
#!/bin/sh
# postinst script for grommunio-sync
#
# see: dh_installdeb(1)
set -e
# Use debconf
. /usr/share/debconf/confmodule
set_perms() {
USER="$1"
GROUP="$2"
MODE="$3"
FILE="$4"
if ! dpkg-statoverride --list "$FILE" > /dev/null 2>&1; then
chown -h "$USER:$GROUP" "$FILE"
chmod $MODE "$FILE"
fi
}
case "$1" in
configure|reconfigure)
# Set permissions
if [ -x /usr/bin/systemd-sysusers ]; then
/usr/bin/systemd-sysusers grommunio-sync.conf
else
getent group grosync >/dev/null || addgroup --system grosync
getent passwd grosync >/dev/null || \
adduser --system grosync --home / --no-create-home --disabled-password --ingroup grosync
fi
set_perms root grosync 0770 /etc/grommunio-sync
set_perms grosync grosync 0770 /var/log/grommunio-sync
ln -sfv "/etc/grommunio-sync/grommunio-sync.conf.php" "/usr/share/grommunio-sync/config.php"
ln -sfv "/usr/share/grommunio-sync/grommunio-sync-top.php" "/usr/sbin/grommunio-sync-top"
systemctl list-units --plain --no-legend --quiet "php*fpm.service" | \
awk '{print$1}' | xargs /usr/bin/systemctl try-restart
if [ -f /usr/share/grommunio-common/nginx/locations.d/grommunio-sync.conf ]; then
/usr/bin/systemctl reload nginx.service
fi
;;
abort-upgrade|abort-remove|abort-deconfigure)
;;
*)
echo "postinst called with unknown argument \`$1'" >&2
exit 1
;;
esac
#DEBHELPER#
exit 0