„scripts/start-server.sh“ ändern

This commit is contained in:
2020-03-25 22:30:43 +01:00
parent 00da2fab51
commit 27dff3c760

View File

@@ -41,86 +41,86 @@ echo "---Starting MariaDB...---"
screen -S MariaDB -L -Logfile ${SERVER_DIR}/MariaDBLog.0 -d -m mysqld_safe screen -S MariaDB -L -Logfile ${SERVER_DIR}/MariaDBLog.0 -d -m mysqld_safe
sleep 10 sleep 10
echo "---Checking for ExileMod---" #echo "---Checking for ExileMod---"
if [ ! -d ${SERVER_DIR}/data ]; then #if [ ! -d ${SERVER_DIR}/data ]; then
echo "---ExileMod not found, creating 'data' directory---" # echo "---ExileMod not found, creating 'data' directory---"
cd ${SERVER_DIR} # cd ${SERVER_DIR}
mkdir ${SERVER_DIR}/data # mkdir ${SERVER_DIR}/data
cd ${SERVER_DIR}/data # cd ${SERVER_DIR}/data
echo "---Downloading ExileMod Server---" # echo "---Downloading ExileMod Server---"
if wget -q -nc --show-progress --progress=bar:force:noscroll ${EXILEMOD_SERVER_URL} ; then # if wget -q -nc --show-progress --progress=bar:force:noscroll ${EXILEMOD_SERVER_URL} ; then
echo "---Sucessfully downloaded ExileMod Server---" # echo "---Sucessfully downloaded ExileMod Server---"
else # else
echo "---Can't download ExileMod Server, putting server into sleep mode---" # echo "---Can't download ExileMod Server, putting server into sleep mode---"
sleep infinity # sleep infinity
fi # fi
unzip ${EXILEMOD_SERVER_URL##*/} # unzip ${EXILEMOD_SERVER_URL##*/}
cp -R ${SERVER_DIR}/data/Arma\ 3\ Server/* ${SERVER_DIR} # cp -R ${SERVER_DIR}/data/Arma\ 3\ Server/* ${SERVER_DIR}
rm -R ${SERVER_DIR}/data/Arma\ 3\ Server/ # rm -R ${SERVER_DIR}/data/Arma\ 3\ Server/
rm ${SERVER_DIR}/data/${EXILEMOD_SERVER_URL##*/} # rm ${SERVER_DIR}/data/${EXILEMOD_SERVER_URL##*/}
touch ${SERVER_DIR}/data/"${EXILEMOD_SERVER_URL##*/}_installed" # touch ${SERVER_DIR}/data/"${EXILEMOD_SERVER_URL##*/}_installed"
if [ ! -d ${SERVER_DIR}/@ExileServer ]; then # if [ ! -d ${SERVER_DIR}/@ExileServer ]; then
echo "---Something went wrong, ExileModServer not correctly installed---" # echo "---Something went wrong, ExileModServer not correctly installed---"
sleep infinity # sleep infinity
fi # fi
echo "---ExileMod Server successfully installed---" # echo "---ExileMod Server successfully installed---"
echo "---Downloading ExileMod (this can take some time)---" # echo "---Downloading ExileMod (this can take some time)---"
cd ${SERVER_DIR}/data # cd ${SERVER_DIR}/data
if wget -q -nc --show-progress --progress=bar:force:noscroll ${EXILEMOD_URL} ; then # if wget -q -nc --show-progress --progress=bar:force:noscroll ${EXILEMOD_URL} ; then
echo "---Sucessfully downloaded ExileMod---" # echo "---Sucessfully downloaded ExileMod---"
else # else
echo "---Can't download ExileMod, putting server into sleep mode---" # echo "---Can't download ExileMod, putting server into sleep mode---"
sleep infinity # sleep infinity
fi # fi
unzip ${EXILEMOD_URL##*/} # unzip ${EXILEMOD_URL##*/}
mv ${SERVER_DIR}/data/@Exile ${SERVER_DIR} # mv ${SERVER_DIR}/data/@Exile ${SERVER_DIR}
rm ${SERVER_DIR}/data/${EXILEMOD_URL##*/} # rm ${SERVER_DIR}/data/${EXILEMOD_URL##*/}
touch ${SERVER_DIR}/data/"${EXILEMOD_URL##*/}_installed" # touch ${SERVER_DIR}/data/"${EXILEMOD_URL##*/}_installed"
if [ ! -d ${SERVER_DIR}/@Exile ]; then # if [ ! -d ${SERVER_DIR}/@Exile ]; then
echo "---Something went wrong, ExileMod not correctly installed---" # echo "---Something went wrong, ExileMod not correctly installed---"
sleep infinity # sleep infinity
fi # fi
echo "---ExileMod successfully installed---" # echo "---ExileMod successfully installed---"
fi #fi
echo "---Checking if 'exile' database is connected correctly---" #echo "---Checking if 'exile' database is connected correctly---"
INJECTED="$(mysql -u "steam" -p"exile" -e "USE 'exile'; SHOW TABLES;" | grep 'account')" #INJECTED="$(mysql -u "steam" -p"exile" -e "USE 'exile'; SHOW TABLES;" | grep 'account')"
if [ "$INJECTED" = "" ] ; then #if [ "$INJECTED" = "" ] ; then
echo "---Database not connected, connecting...---" # echo "---Database not connected, connecting...---"
mysql -u "steam" -p"exile" -e "SOURCE $SERVER_DIR/data/MySQL/exile.sql" # mysql -u "steam" -p"exile" -e "SOURCE $SERVER_DIR/data/MySQL/exile.sql"
INJECTED="$(mysql -u "steam" -p"exile" -e "USE 'exile'; SHOW TABLES;" | grep 'account')" # INJECTED="$(mysql -u "steam" -p"exile" -e "USE 'exile'; SHOW TABLES;" | grep 'account')"
if [ "$INJECTED" = "account" ] ; then # if [ "$INJECTED" = "account" ] ; then
echo "---Database successfully connected!---" # echo "---Database successfully connected!---"
else # else
echo "---Something went wrong, could not connect database!---" # echo "---Something went wrong, could not connect database!---"
sleep infinity # sleep infinity
fi # fi
fi #fi
if [ "$INJECTED" = "account" ] ; then #if [ "$INJECTED" = "account" ] ; then
echo "---Database setup correct!---" # echo "---Database setup correct!---"
fi #fi
echo "---Checking if ExileMod is configured correctly for database connection---" #echo "---Checking if ExileMod is configured correctly for database connection---"
if grep -rq 'Username = changeme' ${SERVER_DIR}/@ExileServer/extdb-conf.ini; then #if grep -rq 'Username = changeme' ${SERVER_DIR}/@ExileServer/extdb-conf.ini; then
sed -i '/Username = changeme/c\Username = steam' ${SERVER_DIR}/@ExileServer/extdb-conf.ini # sed -i '/Username = changeme/c\Username = steam' ${SERVER_DIR}/@ExileServer/extdb-conf.ini
sed -i '/Username = steam/!b;n;cPassword = exile' ${SERVER_DIR}/@ExileServer/extdb-conf.ini # sed -i '/Username = steam/!b;n;cPassword = exile' ${SERVER_DIR}/@ExileServer/extdb-conf.ini
echo "---Corrected ExileMod database connection---" # echo "---Corrected ExileMod database connection---"
fi #fi
if grep -rq 'Username = steam' ${SERVER_DIR}/@ExileServer/extdb-conf.ini; then #if grep -rq 'Username = steam' ${SERVER_DIR}/@ExileServer/extdb-conf.ini; then
if grep -rq 'Password = exile' ${SERVER_DIR}/@ExileServer/extdb-conf.ini; then # if grep -rq 'Password = exile' ${SERVER_DIR}/@ExileServer/extdb-conf.ini; then
: # :
else # else
sed -i '/Username = steam/!b;n;cPassword = exile' ${SERVER_DIR}/@ExileServer/extdb-conf.ini # sed -i '/Username = steam/!b;n;cPassword = exile' ${SERVER_DIR}/@ExileServer/extdb-conf.ini
fi # fi
echo "---ExileMod database connection correct---" # echo "---ExileMod database connection correct---"
fi #fi
echo "---Prepare Server---" echo "---Prepare Server---"
cp ${DATA_DIR}/steamcmd/linux32/* ${SERVER_DIR} cp ${DATA_DIR}/steamcmd/linux32/* ${SERVER_DIR}
chmod -R ${DATA_PERM} ${DATA_DIR} chmod -R ${DATA_PERM} ${DATA_DIR}
echo "---Putting server to sleep, Docker is now under Construction---" echo "---Putting server to sleep, Container is now under construction---"
sleep infinity sleep infinity
echo "---Start Server---" echo "---Start Server---"