From 6ab07f04db48380a6354a142888a03a3d373b897 Mon Sep 17 00:00:00 2001 From: TheBrokenRail Date: Wed, 10 Feb 2021 20:03:19 -0500 Subject: [PATCH] Improve Image --- .../minecraft-pi/server/docker-compose.yml | 2 ++ launcher/src/run.sh | 35 ++++++++++--------- 2 files changed, 21 insertions(+), 16 deletions(-) diff --git a/debian/server/usr/share/minecraft-pi/server/docker-compose.yml b/debian/server/usr/share/minecraft-pi/server/docker-compose.yml index 88dbffa16..f1803087e 100644 --- a/debian/server/usr/share/minecraft-pi/server/docker-compose.yml +++ b/debian/server/usr/share/minecraft-pi/server/docker-compose.yml @@ -3,6 +3,8 @@ services: minecraft-pi-server: image: 'thebrokenrail/minecraft-pi-reborn:server' network_mode: 'host' + stdin_open: true + tty: true volumes: - /usr/bin/qemu-arm-static:/usr/bin/qemu-arm-static - '${MCPI_ROOT}:/home/.minecraft-pi' diff --git a/launcher/src/run.sh b/launcher/src/run.sh index 85d3353b4..32947b3e2 100755 --- a/launcher/src/run.sh +++ b/launcher/src/run.sh @@ -8,24 +8,27 @@ if [ ! "$(id -u)" = '0' ]; then exit 1 fi -# Create User Groups -if [ -z "${USER_GID+x}" ]; then - USER_GID='1000' -fi -groupadd --force --gid "${USER_GID}" user +# Check +if ! id user > /dev/null 2>&1; then + # Create User Groups + if [ -z "${USER_GID+x}" ]; then + USER_GID='1000' + fi + groupadd --force --gid "${USER_GID}" user -# Create User -if [ -z "${USER_UID+x}" ]; then - USER_UID='1000' -fi -useradd --shell /bin/sh --home-dir /home --no-create-home --uid "${USER_UID}" --gid "${USER_GID}" user + # Create User + if [ -z "${USER_UID+x}" ]; then + USER_UID='1000' + fi + useradd --shell /bin/sh --home-dir /home --no-create-home --uid "${USER_UID}" --gid "${USER_GID}" user -# Add Other Groups -if [ ! -z "${USER_OTHER_GIDS+x}" ]; then - for gid in ${USER_OTHER_GIDS}; do - groupadd --force --gid "${gid}" "group-${gid}" - usermod -aG "${gid}" user - done + # Add Other Groups + if [ ! -z "${USER_OTHER_GIDS+x}" ]; then + for gid in ${USER_OTHER_GIDS}; do + groupadd --force --gid "${gid}" "group-${gid}" + usermod -aG "${gid}" user + done + fi fi # Start