#!/bin/bash
#
# Copyright (C) 2002-2021  AfterLogic Corp. (www.afterlogic.com)
# Distributed under the terms of the license described in LICENSE
#

function configure_package {
    local PACKAGE_DIR=$1
    local DB_NAME=$2
    local DB_USER=$3
    local DB_PASS=$4
    
#   echo "pack: $PACKAGE_DIR name: $DB_NAME user: $DB_USER pass: $DB_PASS\r\n"
    
    /usr/local/cpanel/3rdparty/bin/php ./configure "configure_pro" $PACKAGE_DIR $DB_NAME $DB_USER $DB_PASS
    if [ $? -gt 0 ]; then
	return 1
    fi

    perl ./cPanel/pro/integrate.perl
    if [ $? -gt 0 ]; then
	return 1
    fi
    
    return 0
}

function print_footer {
    echo "Navigate to WebMail Pro https://`hostname`:2096/3rdparty/afterlogic/webmail/adminpanel/ for checking licensing setting and other options."
    echo "Admin User: superadmin"
    echo "Admin Password: no password"
}