diff --git a/start-configuration b/start-configuration index ea1e5cb8..57a48b67 100644 --- a/start-configuration +++ b/start-configuration @@ -8,8 +8,7 @@ shopt -s nullglob export HOME=/data if [ ! -e /data/eula.txt ]; then - EULA="${EULA,,}" - if [ "$EULA" != "true" ]; then + if ! isTrue "$EULA"; then log "" log "Please accept the Minecraft EULA at" log " https://account.mojang.com/documents/minecraft_eula" @@ -19,12 +18,7 @@ if [ ! -e /data/eula.txt ]; then exit 1 fi - echo "# Generated via Docker on $(date)" > /data/eula.txt - - if ! echo "eula=$EULA" >> /data/eula.txt; then - log "ERROR: unable to write eula to /data. Please make sure attached directory is writable by uid=${UID}" - exit 2 - fi + writeEula fi diff --git a/start-utils b/start-utils index ffbdec29..a46d1a28 100644 --- a/start-utils +++ b/start-utils @@ -113,3 +113,12 @@ requireVar() { exit 1 fi } + +function writeEula() { +if ! echo "# Generated via Docker on $(date) +eula=${EULA,,} +" > /data/eula.txt; then + log "ERROR: unable to write eula to /data. Please make sure attached directory is writable by uid=${UID}" + exit 2 +fi +}