#!/bin/bash
#
#########################################################################################
# Script: 		absmenu_install.sh
# Description: 	Install script (set rights etc.)
# Author: 		ABS Laundry Business Solutions
# Version: 		9.08.00
#### Changelog of script ################################################################
# Date        Author    Version 	Change    
# 15-May-2011 JMI		1.0			Initial version
# 20-Mar-2024 RAY       6.0  		Support for Glassfish4, Payara5, Tomee8, Tomee91 and Tomcat90
# 03-Apr-2024 RAY       9.08.00		Renamed version
# 25-Apr-2024 RAY       9.08.00     Added Support for Tomcat9 - ABS-164468
# 01-Jul-2024 RAY       9.08.01     Added Support for Tomcat9 and Tomcat10 - ABS-165658
# 21-Aug-2024 RAY       9.08.01     TI changes for replacing TomEE with Tomcat in 9.08.00 - ABS-167946
#########################################################################################

chmod 700 *.sh
chmod 700 ../config/*.sh
chmod 700 ../../absmenu.sh
chmod 700 ../../abs.sh
chmod 700 ../../abs_config.sh

dos2unix *.sh
dos2unix ../config/*.sh
dos2unix ../../absmenu.sh
dos2unix ../../abs.sh
dos2unix ../../abs_config.sh

if [ ! -e ../config/absmenu_config.sh ]
then
    if [ -e ../config/sample_absmenu_config.sh ]
    then
        cp ../config/sample_absmenu_config.sh ../config/absmenu_config.sh
    else
        echo NO ABSMENU_CONFIG.SH AND NO SAMPLE_ABSMENU_CONFIG.SH FOUND
    fi
fi

if [ ! -e ../config/service_registration.cfg ]
then
    if [ -e ../config/sample_service_registration.cfg ]
    then
        cp ../config/sample_service_registration.cfg ../config/service_registration.cfg
    else
        echo NO SERVICE_REGISTRATION.CFG AND NO SAMPLE_SERVICE_REGISTRATION.CFG FOUND
    fi
fi

if [ ! -e ../config/custom_properties.cfg ]
then
    if [ -e ../config/sample_custom_properties.cfg ]
    then
        cp ../config/sample_custom_properties.cfg ../config/custom_properties.cfg
    else
        echo NO CUSTOM_PROPERTIES.CFG AND NO SAMPLE_CUSTOM_PROPERTIES.CFG FOUND
    fi
fi