#!/bin/bash -
#
# Copyright (C) 2017  Tetras Libre <admin@tetras-libre.fr>
# Author: Curt, Sebastien <sebastien.curt@tetras-libre.fr>
#
# This program 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.
#
# This program 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 this program.  If not, see <http://www.gnu.org/licenses/>.

set -o nounset                              # Treat unset variables as an error

echo "RUN $(basename "$0") ==="

if [ ! -e `pwd`/main.env ]
then
    echo "Please copy `pwd`/main.env.sample to `pwd`/main.env and edit it"
    exit 1
fi
. `pwd`/main.env

for mod in $MODS
do
    cmd="$DIR/install/$mod.sh"
    if [ -f $cmd ]
    then
        bash $cmd | tee -a $mod.log install.log
    fi
done