2020-09-25 19:37:22 -04:00
|
|
|
#!/bin/sh
|
|
|
|
|
|
|
|
set -e
|
|
|
|
|
2020-10-01 15:11:27 -04:00
|
|
|
# Ensure Features Are Selected
|
2020-10-01 15:25:02 -04:00
|
|
|
if [ -z "${MCPI_SUBSHELL}" ]; then
|
2020-10-05 18:29:58 -04:00
|
|
|
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')"
|
2020-10-01 15:11:27 -04:00
|
|
|
fi
|
|
|
|
export MCPI_FEATURES
|
2020-10-02 18:43:43 -04:00
|
|
|
export MCPI_USERNAME
|
2020-10-01 11:08:46 -04:00
|
|
|
|
2020-10-01 15:11:27 -04:00
|
|
|
# Ensure Groups Are Correct
|
2020-10-01 15:25:02 -04:00
|
|
|
if [ -z "${MCPI_SUBSHELL}" ]; then
|
2020-10-01 15:11:27 -04:00
|
|
|
if ! id -Gn "$(whoami)" | grep '\bdocker\b' > /dev/null; then
|
2020-10-15 22:24:46 -04:00
|
|
|
pkexec usermod -aG docker "$(whoami)"
|
2020-10-01 15:11:27 -04:00
|
|
|
fi
|
2020-10-01 15:25:02 -04:00
|
|
|
exec sg docker "env MCPI_SUBSHELL=1 \"$(realpath -e "$0")\""
|
2020-10-01 14:33:52 -04:00
|
|
|
fi
|
|
|
|
|
2020-10-01 15:11:27 -04:00
|
|
|
# Allow X11 Connections From Root
|
2020-09-25 19:37:22 -04:00
|
|
|
xhost local:root
|
|
|
|
|
2020-10-16 15:39:04 -04:00
|
|
|
# Update Docker Container
|
|
|
|
export DOCKER_COMPOSE="docker-compose -f /usr/share/minecraft-pi/client/docker-compose.yml"
|
2020-10-10 19:02:13 -04:00
|
|
|
(${DOCKER_COMPOSE} pull || :) | zenity --class 'Minecraft - Pi edition' --progress --pulsate --no-cancel --auto-close --text 'Updating Minecraft...'
|
2020-10-14 22:51:30 -04:00
|
|
|
|
2020-10-16 15:39:04 -04:00
|
|
|
# Run
|
|
|
|
/usr/lib/minecraft-pi/run.sh
|