minecraft-pi-reborn/debian/client/common/usr/bin/minecraft-pi

30 lines
1.2 KiB
Bash
Executable File

#!/bin/sh
set -e
# Ensure Features Are Selected
if [ -z "${MCPI_SUBSHELL}" ]; then
MCPI_FEATURES="$(zenity --class 'Minecraft - Pi edition' --list --checklist --column 'Enabled' --column 'Feature' TRUE 'Touch GUI' FALSE 'Survival Mode' TRUE 'Fix Bow & Arrow' TRUE 'Fix Attacking' TRUE 'Mob Spawning' TRUE 'Fancy Graphics' TRUE 'Disable Autojump By Default' TRUE 'Fix Sign Placement' TRUE 'Show Block Outlines')"
MCPI_USERNAME="$(zenity --class 'Minecraft - Pi edition' --entry --text 'Minecraft Username:' --entry-text 'StevePi')"
fi
export MCPI_FEATURES
export MCPI_USERNAME
# Ensure Groups Are Correct
if [ -z "${MCPI_SUBSHELL}" ]; then
if ! id -Gn "$(whoami)" | grep '\bdocker\b' > /dev/null; then
pkexec usermod -aG docker "$(whoami)"
fi
exec sg docker "env MCPI_SUBSHELL=1 \"$(realpath -e "$0")\""
fi
# Allow X11 Connections From Root
xhost local:root
# Update Docker Container
export DOCKER_COMPOSE="docker-compose -f /usr/share/minecraft-pi/client/docker-compose.yml"
(${DOCKER_COMPOSE} pull || :) | zenity --class 'Minecraft - Pi edition' --progress --pulsate --no-cancel --auto-close --text 'Updating Minecraft...'
# Run
/usr/lib/minecraft-pi/run.sh