#!/bin/bash

# Copyright (c) Cloud Linux GmbH & Cloud Linux Software, Inc 2021 All Rights Reserved
#
# Licensed under CLOUD LINUX LICENSE AGREEMENT
# http://cloudlinux.com/docs/LICENSE.TXT

function do_exit() {
    # In order to forcefully fail current build even when custom_build script ignores exit code
    [ -f CMakeLists.txt ] && rm CMakeLists.txt
    exit $1
}

is_cloudlinux_solo() {
        CL_SOLO_FILE=/etc/cloudlinux-edition-solo
        if [ -e "$CL_SOLO_FILE" ]; then
                echo 1
        else
                echo 0
        fi
        return
}

DA_LOG_DIR="/usr/share/lve/da_lsapi/"
DA_LOG_FILE="$DA_LOG_DIR/da_cb_install.log"
mkdir -p "$DA_LOG_DIR"


if [ $(is_cloudlinux_solo) -eq 1 ]; then
    echo "*** mod_hostinglimits.da_cb_install: CloudLinux Solo edition does no support mod_hostinglimits ***"
    echo "$(date): *** mod_hostinglimits.da_cb_install: CloudLinux Solo edition does no support mod_hostinglimits ***">>"$DA_LOG_FILE"
    do_exit 1
fi

# Nothing to do except Solo check
exit 0
