#!/bin/bash

if [ "$DEBUG" == "True" ] || [ "$DEBUG" == "true" ]; then
    set -xe
    sed -i 's/LogLevel.*/LogLevel = 10/g' "$SINUS_DIR/config.ini"
fi

echo "-> Checking if scripts directory is empty"
if [ ! -f "$SINUS_DATA_SCRIPTS/.docker-sinusbot-installed" ]; then
    echo "-> Copying original sinusbot scripts to volume ..."
    cp -af "$SINUS_DATA_SCRIPTS-orig/"* "$SINUS_DATA_SCRIPTS"
    touch "$SINUS_DATA_SCRIPTS/.docker-sinusbot-installed"
    echo "=> Sinusbot scripts copied."
else
    echo "=> Scripts directory is marked, scripts were already copied. Nothing to do."
fi

if [ ! -f "$SINUS_CONFIG/config.ini" ]; then
    echo "-> No $SINUS_CONFIG/config.ini found, copying."
    mv "$SINUS_DIR/config.ini" "$SINUS_CONFIG/config.ini"
fi
echo "-> Linking $SINUS_CONFIG/config.ini to $SINUS_DIR/config.ini ..."
rm -f "$SINUS_DIR/config.ini"
ln -s "$SINUS_CONFIG/config.ini" "$SINUS_DIR/config.ini"
echo "=> Linked $SINUS_CONFIG/config.ini to $SINUS_DIR/config.ini."

echo "=> Starting SinusBot (https://sinusbot.com) by Michael Friese ..."
exec "$SINUS_DIR/sinusbot" "$@"

#!/bin/bash

if [ "$DEBUG" == "True" ] || [ "$DEBUG" == "true" ]; then
    set -xe
    sed -i 's/LogLevel.*/LogLevel = 10/g' "$SINUS_DIR/config.ini"
fi

echo "-> Checking if scripts directory is empty"
if [ ! -f "$SINUS_DATA_SCRIPTS/.docker-sinusbot-installed" ]; then
    echo "-> Copying original sinusbot scripts to volume ..."
    cp -af "$SINUS_DATA_SCRIPTS-orig/"* "$SINUS_DATA_SCRIPTS"
    touch "$SINUS_DATA_SCRIPTS/.docker-sinusbot-installed"
    echo "=> Sinusbot scripts copied."
else
    echo "=> Scripts directory is marked, scripts were already copied. Nothing to do."
fi

if [ -d "$SINUS_CONFIG" ] && [ -f "$SINUS_CONFIG/config.ini" ]; then
    echo "-> Found config in $SINUS_CONFIG directory, linking ..."
    rm "$SINUS_DIR/config.ini"
    ln -s "$SINUS_CONFIG/config.ini" "$SINUS_DIR/config.ini"
    echo "=> Linked $SINUS_CONFIG/config.ini to $SINUS_DIR/config.ini."
else
    echo "-> No $SINUS_CONFIG/config.ini found, not linking."
fi

echo "=> Starting SinusBot (https://sinusbot.com) by Michael Friese ..."
exec "$SINUS_DIR/sinusbot" "$@"

Revert "Always link config, copy config if not exists"
Revert "Always link config, copy config if not exists"

This reverts commit 928c70794ce1a3a4a2569f8a9399f322d5a1fd8d.
