37 lines
1.1 KiB
Plaintext
Raw Normal View History

2020-09-25 19:37:22 -04:00
#!/bin/sh
set -e
2020-12-08 16:32:12 -05:00
# All Feature Flags
2021-01-28 17:04:54 -05:00
export AVAILABLE_FEATURES="$(tr '\n' ' ' < /usr/share/minecraft-pi/client/features)"
2020-12-08 16:32:12 -05:00
# 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"
2020-12-08 16:32:12 -05:00
# Ensure Features Are Selected
2020-12-08 18:20:25 -05:00
if [ -z "${MCPI_FEATURES+x}" ]; then
2021-01-28 17:04:54 -05:00
MCPI_FEATURES="$(eval "zenity --class \"${ZENITY_CLASS}\" --list --checklist --width=600 --height=600 --column 'Enabled' --column 'Feature' ${AVAILABLE_FEATURES}")"
2020-12-08 18:20:25 -05:00
fi
if [ -z "${MCPI_USERNAME+x}" ]; then
MCPI_USERNAME="$(zenity --class "${ZENITY_CLASS}" --entry --text 'Minecraft Username:' --entry-text 'StevePi')"
2020-12-08 18:20:25 -05:00
fi
2020-10-01 15:11:27 -04:00
export MCPI_FEATURES
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-17 16:23:01 -04:00
if ! id -Gn "$(whoami)" | grep '\bdocker\b' > /dev/null; then
2020-12-16 17:55:06 -05:00
pkexec /sbin/usermod -aG docker "$(whoami)"
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
# Run
sg docker /usr/lib/minecraft-pi/pre-launch.sh