Simplify Startup Scripts

This commit is contained in:
TheBrokenRail 2021-01-28 17:04:54 -05:00
parent d824b0f878
commit 7b89f7604f
3 changed files with 25 additions and 27 deletions

View File

@ -3,22 +3,7 @@
set -e
# All Feature Flags
export AVAILABLE_FEATURES="$(echo \
"TRUE 'Touch GUI'" \
"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'" \
"FALSE 'Expand Creative Inventory'" \
"FALSE 'Peaceful Mode'" \
"TRUE 'Animated Water'" \
"TRUE 'Remove Invalid Item Background'" \
"TRUE 'Disable gui_blocks Atlas'" \
"TRUE 'Smooth Lighting'" \
"FALSE '3D Anaglyph'")"
export AVAILABLE_FEATURES="$(tr '\n' ' ' < /usr/share/minecraft-pi/client/features)"
# Print Feature Flags Option
if [ "$1" = "--print-features" ]; then
@ -32,7 +17,7 @@ export DOCKER_COMPOSE="docker-compose -f /usr/share/minecraft-pi/client/docker-c
# Ensure Features Are Selected
if [ -z "${MCPI_FEATURES+x}" ]; then
MCPI_FEATURES="$(sh -c "zenity --class \"${ZENITY_CLASS}\" --list --checklist --width=600 --height=600 --column 'Enabled' --column 'Feature' ${AVAILABLE_FEATURES}")"
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')"

View File

@ -7,23 +7,21 @@ rm -rf /tmp/minecraft-pi
mkdir -p /tmp/minecraft-pi
# Start Logging
LOG="$(mktemp -u)"
mkfifo "${LOG}"
tee /tmp/minecraft-pi/main.log < "${LOG}" &
TEE_PID=$!
touch /tmp/minecraft-pi/main.log
tail -f /tmp/minecraft-pi/main.log &
TAIL_PID=$!
# Run
set +e
/usr/lib/minecraft-pi/run.sh > "${LOG}" 2>&1
/usr/lib/minecraft-pi/run.sh > /tmp/minecraft-pi/main.log 2>&1
RET=$?
set -e
# Kill Logging
kill ${TEE_PID}
rm "${LOG}"
kill ${TAIL_PID}
# Handle Crash
if [ $RET -ne 0 ]; then
zenity --class "${ZENITY_CLASS}" --error --no-wrap --text 'Minecraft: Pi Edition has crashed!\nLogs are located in /tmp/minecraft-pi.'
exit $RET
if [ ${RET} -ne 0 ]; then
zenity --class "${ZENITY_CLASS}" --error --no-wrap --text 'Minecraft: Pi Edition has crashed!\nLogs are located in /tmp/minecraft-pi.\n\nExit Code: '${RET}
exit ${RET}
fi

View File

@ -0,0 +1,15 @@
TRUE 'Touch GUI'
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'
FALSE 'Expand Creative Inventory'
FALSE 'Peaceful Mode'
TRUE 'Animated Water'
TRUE 'Remove Invalid Item Background'
TRUE 'Disable gui_blocks Atlas'
TRUE 'Smooth Lighting'
FALSE '3D Anaglyph'