mirror of
https://github.com/itzg/docker-minecraft-server
synced 2024-11-10 14:24:28 +00:00
fix_properly_set_ftb_properties - use existing variables thus preventing override
This commit is contained in:
parent
230b575983
commit
7afa00b72c
1 changed files with 13 additions and 11 deletions
|
@ -1,14 +1,12 @@
|
|||
#!/bin/bash
|
||||
|
||||
PROPERTIES_PATH=/data/server.properties
|
||||
|
||||
# FUNCTIONS
|
||||
function setServerProp {
|
||||
local prop=$1
|
||||
local var=$2
|
||||
if [ -n "$var" ]; then
|
||||
echo "Setting ${prop} to '${var}' in ${PROPERTIES_PATH}"
|
||||
sed -i "/^$prop\s*=/ c $prop=$var" $PROPERTIES_PATH
|
||||
echo "Setting ${prop} to '${var}' in ${SERVER_PROPERTIES}"
|
||||
sed -i "/^${prop}\s*=/ c ${prop}=${var}" $SERVER_PROPERTIES
|
||||
else
|
||||
echo "Skip setting ${prop}"
|
||||
fi
|
||||
|
@ -16,12 +14,15 @@ function setServerProp {
|
|||
|
||||
# Deploy server.properties file
|
||||
if [ ! -e $PROPERTIES_PATH ]; then
|
||||
echo "Creating server.properties"
|
||||
cp /tmp/server.properties .
|
||||
echo "Creating server.properties in ${SERVER_PROPERTIES}"
|
||||
cp /tmp/server.properties $SERVER_PROPERTIES
|
||||
|
||||
if [[ ! -z ${FTB_DIR} ]]; then
|
||||
PROPERTIES_PATH=${FTB_DIR}/server.properties
|
||||
cp /tmp/server.properties $PROPERTIES_PATH
|
||||
if [[ ${TYPE} == "FEED-THE-BEAST" ]]; then
|
||||
export SERVER_PROPERTIES=${FTB_DIR}/server.properties
|
||||
echo "detected FTB, changing properties path to ${SERVER_PROPERTIES}"
|
||||
cp /tmp/server.properties $SERVER_PROPERTIES
|
||||
else
|
||||
echo "TYPE=${TYPE}"
|
||||
fi
|
||||
|
||||
if [ -n "$WHITELIST" ]; then
|
||||
|
@ -117,9 +118,10 @@ if [ ! -e $PROPERTIES_PATH ]; then
|
|||
exit 1
|
||||
;;
|
||||
esac
|
||||
|
||||
sed -i "/^gamemode\s*=/ c gamemode=$MODE" $SERVER_PROPERTIES
|
||||
setServerProp "gamemode" "$MODE"
|
||||
fi
|
||||
else
|
||||
echo "server.properties already created, skipping"
|
||||
fi
|
||||
|
||||
exec /start-minecraftFinalSetup $@
|
||||
|
|
Loading…
Reference in a new issue