From f2c2fdff434245d2d99d7b46fddc7c10305c8d53 Mon Sep 17 00:00:00 2001 From: TheBrokenRail Date: Thu, 1 Oct 2020 14:33:52 -0400 Subject: [PATCH] Remove SetUID Usage --- debian/DEBIAN/control | 2 +- debian/usr/bin/minecraft-pi | 7 ++++++- scripts/package.sh | 3 --- 3 files changed, 7 insertions(+), 5 deletions(-) diff --git a/debian/DEBIAN/control b/debian/DEBIAN/control index 4da80c9fa..8b4cbdb71 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 +Depends: docker.io, docker-compose, virgl-server, zenity, policykit-1 diff --git a/debian/usr/bin/minecraft-pi b/debian/usr/bin/minecraft-pi index 063b4d259..6f946cbc0 100755 --- a/debian/usr/bin/minecraft-pi +++ b/debian/usr/bin/minecraft-pi @@ -2,11 +2,16 @@ set -e -export 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')" +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')" +export FEATURES virgl_test_server & PID="$!" +if ! id -Gn "$(whoami)" | grep '\bdocker\b' > /dev/null; then + pkexec adduser "$(whoami)" docker +fi + xhost local:root DOCKER_COMPOSE="docker-compose -f /usr/share/minecraft-pi/docker-compose.yml" diff --git a/scripts/package.sh b/scripts/package.sh index e3a365b14..23a67967d 100755 --- a/scripts/package.sh +++ b/scripts/package.sh @@ -5,9 +5,6 @@ set -e # Docker Messes With SetGID chmod -R g-s debian -# Allow minecraft-pi Script To Use Docker -chmod u+s debian/usr/bin/minecraft-pi - # Clean out Directory rm -rf out mkdir out