#!/bin/bash -e

. /usr/share/debconf/confmodule

CONFIGFILE="/etc/alternc/local.sh"

case "$1" in
  configure)
    . "$CONFIGFILE"

    # Then, configure the quota for "ssl"
    /usr/lib/alternc/quota_init ssl 0 

    echo "Installing mysql table"
    mysql --defaults-file=/etc/alternc/my.cnf -f < /usr/share/alternc/install/ssl.sql || true
    
    echo "installing required apache modules" 
    a2enmod ssl

    echo "$2" >/var/lib/alternc/backups/alternc-ssl-lastversion

    echo -e "\033[31m**********************************************"
    echo "*                                            *"
    echo "*   ALTERNC-SSL    ACTION REQUESTED          *"
    echo "*                                            *"
    echo "* Please run alternc.install to fully deploy *"
    echo "* Then change your quota to activate SSL Cert*"
    echo "*                                            *"
    echo "**********************************************"
    echo -e "\033[0m"
    ;;

  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#

# vim: et sw=4