Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 20 additions & 2 deletions runner/entrypoint.sh
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,12 @@ function _replace_conf()
local REPLACE_WITH="${2}"
local FILENAME="${3}"

sed -i "/^${SEARCH_FOR}/c\\${SEARCH_FOR} = ${REPLACE_WITH}" "${FILENAME}"
if grep -q "^${SEARCH_FOR}[[:space:]]*=" "${FILENAME}"
then
sed -i "s|^${SEARCH_FOR}[[:space:]]*=.*|${SEARCH_FOR} = ${REPLACE_WITH}|" "${FILENAME}"
else
echo "${SEARCH_FOR} = ${REPLACE_WITH}" >> "${FILENAME}"
fi
}
function _merge_confs()
{
Expand All @@ -22,7 +27,7 @@ function _merge_confs()
do
PROPERTY="$(echo "${LINE}" | cut -d '#' -f 1 | sed -e 's/^[[:space:]]*//' -e 's/[[:space:]]*$//')"

if [[ -n "${PROPERTY}" ]]
if [[ -n "${PROPERTY}" && "${PROPERTY}" == *"="* ]]
then
local SEARCH_FOR="$(echo "${PROPERTY}" | cut -d '=' -f 1 | sed -e 's/^[[:space:]]*//' -e 's/[[:space:]]*$//')"
local REPLACE_WITH="$(echo "${PROPERTY}" | cut -d '=' -f 2- | sed -e 's/^[[:space:]]*//' -e 's/[[:space:]]*$//')"
Expand Down Expand Up @@ -66,6 +71,18 @@ function compose_realmd_conf()
_merge_confs realmd.conf "/opt/mangos/conf/realmd.conf"
fi
}
function compose_aiplayerbot_conf()
{
cd "${MANGOS_DIR}/etc"
if [[ -f "aiplayerbot.conf.dist" ]]
then
cp aiplayerbot.conf.dist aiplayerbot.conf
if [[ -f "/opt/mangos/conf/aiplayerbot.conf" ]]
then
_merge_confs aiplayerbot.conf "/opt/mangos/conf/aiplayerbot.conf"
fi
fi
}

function set_timezone()
{
Expand All @@ -88,6 +105,7 @@ function init_runner()

compose_mangosd_conf
compose_realmd_conf
compose_aiplayerbot_conf
}

function run_mangosd()
Expand Down