Only write EULA when it's set to TRUE (#387)

* Only write EULA when it's set to `TRUE`

- This prevents a false value to be written while not being able to correct it afterwards using the environment variable.

* Convert EULA value to upper case to allow lower case `true` as value
This commit is contained in:
Björn Richter 2019-09-16 00:15:33 +02:00 committed by Geoff Bourne
parent 62a4541df5
commit 34d4ae0b59

View file

@ -6,14 +6,8 @@ shopt -s nullglob
export HOME=/data
if [ ! -e /data/eula.txt ]; then
if [ "$EULA" != "" ]; then
echo "# Generated via Docker on $(date)" > eula.txt
echo "eula=$EULA" >> eula.txt
if [ $? != 0 ]; then
echo "ERROR: unable to write eula to /data. Please make sure attached directory is writable by uid=${UID}"
exit 2
fi
else
EULA="${EULA^^}"
if [ "$EULA" != "TRUE" ]; then
echo ""
echo "Please accept the Minecraft EULA at"
echo " https://account.mojang.com/documents/minecraft_eula"
@ -22,8 +16,16 @@ if [ ! -e /data/eula.txt ]; then
echo ""
exit 1
fi
echo "# Generated via Docker on $(date)" > eula.txt
echo "eula=$EULA" >> eula.txt
if [ $? != 0 ]; then
echo "ERROR: unable to write eula to /data. Please make sure attached directory is writable by uid=${UID}"
exit 2
fi
fi
echo "Running as uid=$(id -u) gid=$(id -g) with /data as '$(ls -lnd /data)'"
if ! touch /data/.verify_access; then