#!/bin/sh set -e # All Feature Flags export AVAILABLE_FEATURES="$(tr '\n' ' ' < /usr/share/minecraft-pi/client/features)" # Print Feature Flags Option if [ "$1" = "--print-features" ]; then echo "${AVAILABLE_FEATURES}" exit 0 fi # Export Important Variables export ZENITY_CLASS='Minecraft - Pi edition' export DOCKER_COMPOSE="docker-compose -f /usr/share/minecraft-pi/client/docker-compose.yml" # Ensure Features Are Selected if [ -z "${MCPI_FEATURES+x}" ]; then MCPI_FEATURES="$(eval "zenity --class \"${ZENITY_CLASS}\" --list --checklist --width=600 --height=600 --column 'Enabled' --column 'Feature' ${AVAILABLE_FEATURES}")" fi if [ -z "${MCPI_USERNAME+x}" ]; then MCPI_USERNAME="$(zenity --class "${ZENITY_CLASS}" --entry --text 'Minecraft Username:' --entry-text 'StevePi')" fi export MCPI_FEATURES export MCPI_USERNAME # Ensure Groups Are Correct if ! id -Gn "$(whoami)" | grep '\bdocker\b' > /dev/null; then pkexec /sbin/usermod -aG docker "$(whoami)" fi # Allow X11 Connections From Root xhost local:root # Run sg docker /usr/lib/minecraft-pi/pre-launch.sh