File debian.gromox.postinst of Package gromox

#!/bin/sh
# postinst script for grommunio-admin-api
#
# see: dh_installdeb(1)

set -e

. /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 "$USER:$GROUP" "$FILE"
		chmod $MODE "$FILE"
        fi
}

xpostinst()
{
	set_perms grommunio gromoxcf 0755 /etc/gromox || :
	for i in /var/lib/gromox \
		/var/lib/gromox/domain \
		/var/lib/gromox/user \
		/var/lib/gromox/queue \
		/var/lib/gromox/queue/cache \
		/var/lib/gromox/queue/mess \
		/var/lib/gromox/queue/save \
		/var/lib/gromox/queue/timer; do
		set_perms gromox gromox 0770 "$i" || :
	done
	set_perms gromox gromox 0750 /var/log/gromox || :

	# %post
	if test -x /usr/bin/systemctl; then
		systemctl daemon-reload || :
		systemctl try-restart \
			php7.4-fpm.service php8.0-fpm.service php8.1-fpm.service \
			php8.2-fpm.service php8.3-fpm.service \
			saslauthd.service 2>/dev/null || :
	fi
}

# 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|reconfigure)
	;;
abort-upgrade|abort-remove|abort-deconfigure)
	;;
*)
	echo "postinst called with unknown argument \"$1\"" >&2
	exit 1
	;;
esac

# dh_installdeb will replace this with shell code automatically
# generated by other debhelper scripts.

#DEBHELPER#

xpostinst

exit 0
openSUSE Build Service is sponsored by