89 lines
2.5 KiB
Bash
89 lines
2.5 KiB
Bash
#!/bin/sh
|
|
|
|
set -e
|
|
|
|
# Source debconf library.
|
|
. /usr/share/debconf/confmodule
|
|
|
|
CONFIGFILE="/etc/alternc/local.sh"
|
|
|
|
# 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>
|
|
# * <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
|
|
#
|
|
# quoting from the policy:
|
|
# Any necessary prompting should almost always be confined to the
|
|
# post-installation script, and should be protected with a conditional
|
|
# so that unnecessary prompting doesn't happen if a package's
|
|
# installation fails and the `postinst' is called with `abort-upgrade',
|
|
# `abort-remove' or `abort-deconfigure'.
|
|
|
|
case "$1" in
|
|
configure)
|
|
|
|
if [ -e $CONFIGFILE ]; then
|
|
# source local.sh variables
|
|
. $CONFIGFILE
|
|
fi
|
|
|
|
# /var/alternc/dns/d/www.example.com
|
|
FQDN_LETTER="`echo $FQDN | sed -e 's/.*\.\([^\.]\)[^\.]*\.[^\.]*$/\1/'`"
|
|
if [ "$FQDN_LETTER" = "$FQDN" ]
|
|
then
|
|
FQDN_LETTER="_"
|
|
fi
|
|
|
|
# Erase all apacheconf file
|
|
# They will be regenerated without the bug by upgrade_check.sh below.
|
|
if dpkg --compare-versions "$2" le "0.9.3.9-globenet14"; then
|
|
rm -f /var/alternc/apacheconf/*/*
|
|
rm -f /var/alternc/apacheconf/override_php.conf
|
|
fi
|
|
|
|
# Add access to the management panel
|
|
ln -nsf /var/alternc/bureau /var/alternc/dns/$FQDN_LETTER/$FQDN
|
|
|
|
# Bind stuff
|
|
touch /var/alternc/bind/automatic.conf /var/alternc/bind/slaveip.conf
|
|
chown root:bind /var/alternc/bind/automatic.conf /var/alternc/bind/slaveip.conf
|
|
chmod 640 /var/alternc/bind/automatic.conf /var/alternc/bind/slaveip.conf
|
|
touch /var/run/alternc/refresh_slave
|
|
/usr/lib/alternc/slave_dns
|
|
# Apache will not start without this file
|
|
touch /var/alternc/apacheconf/override_php.conf
|
|
|
|
# Update l18n files
|
|
/usr/share/alternc/install/dopo.sh
|
|
|
|
# Add basedir protection
|
|
/usr/lib/alternc/basedir_prot.sh
|
|
|
|
;;
|
|
|
|
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#
|
|
|
|
exit 0
|
|
|
|
# vim: et sw=4
|