#!/bin/bash
#
# Copyright (C) 2019 OX Software GmbH
# 
# This file is part of OX Automation.
#
# OX Automation is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# OX Automation is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
# 
# See the GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with OX Automation. If not, see <http://www.gnu.org/licenses/>.
#
#
# Authors:
# Benedikt Kroening <benedikt.kroening@open-xchange.com>
#
set -e
SCRIPT_DIR="$( cd "$(dirname "$0")" ; pwd -P)"
# sourcing some commonly used functions and executing basic checks
source ${SCRIPT_DIR}/../lib/common.bash
source ${SCRIPT_DIR}/../lib/setup.bash

# These packages are guard only, please got to the install-middleware.sh script for the middleware realted guard packages
PACKAGES="open-xchange-guard open-xchange-guard-file-storage"
# TODO: config check for s3 storage packages

installPackages ${PACKAGES}


if [[ "${INSTALL_TYPE}" != "docker" ]]; then

    echo ""
    # Post-install actions
    # if [[ "${DIST}" == "DebianJessie" ]]; then
    #     echo "Nothing to do here..."
    #     #update-alternatives --set java /usr/lib/jvm/java-8-openjdk-amd64/jre/bin/java 2>/dev/null
    # elif [[ "${DIST}" == "CENTOS7" ]] || [[ "${DIST}" == "RHEL7" ]] || [[ "${DIST}" == "SLES12" ]]; then
    #     chkconfig open-xchange on
    # elif [[ "${DIST}" == "CENTOS6" ]] || [[ "${DIST}" == "RHEL6" ]]; then
    #     chkconfig --level 345 open-xchange on
    # fi
fi
