Your IP : 18.117.121.244


Current Path : /var/lib/dpkg/info/
Upload File :
Current File : /var/lib/dpkg/info/ispmanager-pkg-roundcube.postinst

#!/bin/bash
# postinst script for coremanager
#
# 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 http://www.debian.org/doc/debian-policy/ or
# the debian-policy package

COREDIR=/usr/local/mgr5
CONFNAME=roundcube.conf
. ${COREDIR}/lib/pkgsh/core_pkg_funcs.sh
. ${COREDIR}/lib/pkgsh/ispmgr_pkg_funcs.sh

if [ "$(lsb_release -s -c)" = "xenial" ] || [ -f /usr/sbin/phpenmod ]; then
	PHPENMOD=phpenmod
else
	PHPENMOD=php5enmod
fi

case "$1" in
    configure)
	test -f /etc/nginx/vhosts-includes/roundcube.conf && rm -f /etc/nginx/vhosts-includes/roundcube.conf
	if [ "$(lsb_release -s -c)" != "bionic" ] && [ "$(lsb_release -s -c)" != "buster" ] && [ "$(lsb_release -s -c)" != "focal" ]; then
		php -m | grep -qi mcrypt || ${PHPENMOD} mcrypt
	fi
	if [ -z "${2}" ]; then
		# debian8
		test -n "$(which a2disconf)" && test -f /etc/apache2/conf-enabled/roundcube.conf && a2disconf -q roundcube || :
	fi
	${COREDIR}/sbin/pkg_configure_roundcube.py $1 $2 || exit 1
	# For autologin for business
	if [ "#${ISPMGR}" = "#ispmgrnode" ]; then
		if [ -f /etc/roundcube/config.inc.php ] && grep -Eq "^\\\$config\['plugins'\] = array\(\$" /etc/roundcube/config.inc.php ; then
			plugin_ar=$(cat /etc/roundcube/config.inc.php | grep -E -A1 "^\\\$config\['plugins'\] = array\(\$" | tail -n1)
			if ! echo "${plugin_ar}" | grep -q autologin ; then
				sed -i -r "/^\\\$config\['plugins'\] = array\(\$/a\    'autologin'," /etc/roundcube/config.inc.php
			fi
		fi
		if [ -f /etc/roundcube/main.inc.php ] && grep -Eq "^\\\$rcmail_config\['plugins'\] = array\(\);\$" /etc/roundcube/main.inc.php ; then
			sed -i -r "s/(^\\\$rcmail_config\['plugins'\] = array\()\);\$/\1 'autologin', );/" /etc/roundcube/main.inc.php
		fi
	fi
	test -f ${COREDIR}/etc/${ISPMGR}.conf.d/${CONFNAME} || ln -sf ../conf.d/${CONFNAME} ${COREDIR}/etc/${ISPMGR}.conf.d/${CONFNAME}
	ReloadMgr ${ISPMGR}

	if [ -z ${2} ]; then
		# Afterinstall
		AfterinstallModule ${ISPMGR} webmail
	fi
    ;;

    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.



exit 0