mc: chown /data when it doesn't match $UID

Fixes #239
This commit is contained in:
Geoff Bourne 2018-08-18 16:56:45 -05:00
parent f65548894f
commit 1c5e4b17bf
2 changed files with 8 additions and 1 deletions

View File

@ -52,7 +52,8 @@ WORKDIR /data
ENTRYPOINT [ "/start" ]
ENV JVM_XX_OPTS="-XX:+UseG1GC" MEMORY="1G" \
ENV UID=1000 GID=1000 \
JVM_XX_OPTS="-XX:+UseG1GC" MEMORY="1G" \
TYPE=VANILLA VERSION=LATEST FORGEVERSION=RECOMMENDED SPONGEBRANCH=STABLE SPONGEVERSION= LEVEL=world \
PVP=true DIFFICULTY=easy ENABLE_RCON=true RCON_PORT=25575 RCON_PASSWORD=minecraft \
LEVEL_TYPE=DEFAULT GENERATOR_SETTINGS= WORLD= MODPACK= SERVER_PORT=25565 ONLINE_MODE=TRUE CONSOLE=true

View File

@ -7,6 +7,12 @@ if [ $(id -u) = 0 ]; then
if [[ -v GID ]]; then
groupmod -g $GID minecraft
fi
if [[ $(stat -c "%u" /data) != $UID ]]; then
echo "Changing ownership of /data to $UID ..."
chown -R minecraft:minecraft /data
fi
su-exec minecraft:minecraft /start-configuration
else
exec /start-configuration