minecraft-pi-reborn/debian/usr/bin/minecraft-pi
2020-10-01 15:11:27 -04:00

38 lines
881 B
Bash
Executable File

#!/bin/sh
set -e
# Ensure Features Are Selected
USER_LAUNCH=1
if [ -z "${MCPI_FEATURES}" ]; 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
# Start VirGL
virgl_test_server &
VIRGL_PID="$!"
# Ensure Groups Are Correct
if [ "${USER_LAUNCH}" = "1" ]; then
if ! id -Gn "$(whoami)" | grep '\bdocker\b' > /dev/null; then
pkexec adduser "$(whoami)" docker
fi
su -p "$(whoami)" "$(realpath -e "$0")"
exit "$?"
fi
# Allow X11 Connections From Root
xhost local:root
# Launch Minecraft
DOCKER_COMPOSE="docker-compose -f /usr/share/minecraft-pi/docker-compose.yml"
${DOCKER_COMPOSE} up
${DOCKER_COMPOSE} down
# Kill VirGL
kill "${VIRGL_PID}"