From 463cc62b75f6dcc3e977150134fe5a01edecdb7e Mon Sep 17 00:00:00 2001 From: Geoff Bourne Date: Sat, 2 Sep 2017 12:24:09 -0500 Subject: [PATCH] [mc] Check writability of /data Document JVM_OPTS For #176 and #177 --- minecraft-server/README.md | 8 +++++++- minecraft-server/start-minecraft.sh | 9 +++++++++ 2 files changed, 16 insertions(+), 1 deletion(-) diff --git a/minecraft-server/README.md b/minecraft-server/README.md index 681c61e1..647421cc 100644 --- a/minecraft-server/README.md +++ b/minecraft-server/README.md @@ -683,7 +683,7 @@ To use this option pass the environment variable `REMOVE_OLD_MODS="TRUE"`, such **NOTE:** This option will be taken into account only when option `MODPACK` is also used. -**WARNING:** All content of the `mods` or `plugins` directory will be deleted +**WARNING:** All content of the `mods` or `plugins` directory will be deleted before unpacking new content from the zip file. ### Online mode @@ -710,3 +710,9 @@ The values of all three are passed directly to the JVM and support format/units ### /data ownership In order to adapt to differences in `UID` and `GID` settings the entry script will attempt to correct ownership and writability of the `/data` directory. This logic can be disabled by setting `-e SKIP_OWNERSHIP_FIX=TRUE`. + +### JVM Options + +General JVM options can be passed to the Minecraft Server invocation by passing a `JVM_OPTS` +environment variable. Options like `-X` that need to proceed general JVM options can be passed +via a `JVM_XX_OPTS` environment variable. diff --git a/minecraft-server/start-minecraft.sh b/minecraft-server/start-minecraft.sh index a1f019e1..54afc7c8 100755 --- a/minecraft-server/start-minecraft.sh +++ b/minecraft-server/start-minecraft.sh @@ -9,6 +9,10 @@ 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 echo "" echo "Please accept the Minecraft EULA at" @@ -20,6 +24,11 @@ if [ ! -e /data/eula.txt ]; then fi fi +if ! touch /data/.verify_access; then + echo "ERROR: /data doesn't seem to be writable. Please make sure attached directory is writable by uid=${UID} " + exit 2 +fi + SERVER_PROPERTIES=/data/server.properties FTB_DIR=/data/FeedTheBeast VERSIONS_JSON=https://launchermeta.mojang.com/mc/game/version_manifest.json