Your IP : 18.226.187.60


Current Path : /var/lib/dpkg/info/
Upload File :
Current File : /var/lib/dpkg/info/ispmanager-lite-common.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
MGR=ispmgr
MGRFULL=Ispmanager-lite

. ${COREDIR}/lib/pkgsh/core_pkg_funcs.sh
. ${COREDIR}/lib/pkgsh/ispmgr_pkg_funcs.sh

case "$1" in
    configure)
	cp -an ${COREDIR}/etc/dist/* ${COREDIR}/etc/
	if [ -z ${2} ]; then
		if [ "#${ISPCONVERT}" = "#yes" ]; then
			:
		else
			# First install
			cd ${COREDIR}
			DisableService shellinabox
			test -f ${COREDIR}/etc/${MGR}.conf || cp -f ${COREDIR}/etc/${MGR}.conf-dist ${COREDIR}/etc/${MGR}.conf
			echo "Option FirstStart" >> ${COREDIR}/etc/${MGR}.conf
			grep -q UsageStatAgree ${COREDIR}/etc/${MGR}.conf || echo "Option UsageStatAgree" >> ${COREDIR}/etc/${MGR}.conf
			grep -q ExternalSSL ${COREDIR}/etc/${MGR}.conf || echo "Option ExternalSSL" >> ${COREDIR}/etc/${MGR}.conf
			grep -q PWStrength ${COREDIR}/etc/${MGR}.conf || echo "PWStrength 2" >> ${COREDIR}/etc/${MGR}.conf
			grep -q ExternalSSLPort ${COREDIR}/etc/${MGR}.conf || echo "ExternalSSLPort 1501" >> ${COREDIR}/etc/${MGR}.conf
			chmod 600 ${COREDIR}/etc/${MGR}.conf
			AddMgr ${MGR}
			AfterinstallMgr ${MGR}
		fi
	else
		UnlockMgr ${MGR}
		AfterupdateMgr ${MGR}
		ReloadMgr notify
	fi
	if [ -f ${COREDIR}/etc/templates/webalizer ] && grep -qE '^(# HASH __ANALYZER__)$' ${COREDIR}/etc/templates/webalizer ; then
		sed -i -r 's/^(\# HASH __ANALYZER__)$/\1 __LOGFILE__/' ${COREDIR}/etc/templates/webalizer || :
	fi
	if [ ! -f ${COREDIR}/etc/.awstats.changed ]; then
		cp ${COREDIR}/etc/dist/templates/awstats ${COREDIR}/etc/templates/
		touch ${COREDIR}/etc/.awstats.changed
	fi
	CronLink ${MGR} 2>/dev/null || :
	AddMgr ${MGR}
	chmod 600 ${COREDIR}/etc/${MGR}.conf

	# Certificate
	if [ ! -f ${COREDIR}/etc/${MGR}.pem ]; then
		openssl genrsa  -out ${COREDIR}/etc/${MGR}.pem 2048 >/dev/null 2>&1 || exit 1
		chmod 400 ${COREDIR}/etc/${MGR}.pem
	fi
	grep -q "path secure-private-key" ${COREDIR}/etc/${MGR}.conf || echo "path secure-private-key ${COREDIR}/etc/${MGR}.pem" >> ${COREDIR}/etc/${MGR}.conf

	ReloadMgr ${MGR}

    ;;

    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