From 48e963ba6fdd05b036a4b4d2163938b38c332f4e Mon Sep 17 00:00:00 2001 From: TheBrokenRail Date: Thu, 1 Oct 2020 15:25:02 -0400 Subject: [PATCH] Tweak Startup Script --- debian/DEBIAN/control | 2 +- debian/usr/bin/minecraft-pi | 11 +++-------- 2 files changed, 4 insertions(+), 9 deletions(-) diff --git a/debian/DEBIAN/control b/debian/DEBIAN/control index 31945b0..1d3f886 100644 --- a/debian/DEBIAN/control +++ b/debian/DEBIAN/control @@ -4,4 +4,4 @@ Maintainer: TheBrokenRail Description: Fun with Blocks Homepage: https://www.minecraft.net/en-us/edition/pi Architecture: amd64 -Depends: docker.io, docker-compose, virgl-server, zenity, policykit-1, adduser +Depends: docker.io, docker-compose, virgl-server, zenity, policykit-1, adduser, login diff --git a/debian/usr/bin/minecraft-pi b/debian/usr/bin/minecraft-pi index 0dcf8ca..991c4d7 100755 --- a/debian/usr/bin/minecraft-pi +++ b/debian/usr/bin/minecraft-pi @@ -3,11 +3,8 @@ set -e # Ensure Features Are Selected -USER_LAUNCH=1 -if [ -z "${MCPI_FEATURES}" ]; then +if [ -z "${MCPI_SUBSHELL}" ]; then MCPI_FEATURES="$(zenity --class minecraft-pi --list --checklist --column 'Enabled' --column 'Feature' FALSE 'Touch GUI' FALSE 'Survival Mode' FALSE 'Fix Bow & Arrow' FALSE 'Fix Attacking' FALSE 'Mob Spawning')" -else - USER_LAUNCH=0 fi export MCPI_FEATURES @@ -16,13 +13,11 @@ virgl_test_server & VIRGL_PID="$!" # Ensure Groups Are Correct -if [ "${USER_LAUNCH}" = "1" ]; then +if [ -z "${MCPI_SUBSHELL}" ]; then if ! id -Gn "$(whoami)" | grep '\bdocker\b' > /dev/null; then pkexec adduser "$(whoami)" docker fi - - su -p "$(whoami)" "$(realpath -e "$0")" - exit "$?" + exec sg docker "env MCPI_SUBSHELL=1 \"$(realpath -e "$0")\"" fi # Allow X11 Connections From Root