Simplify Startup Scripts
minecraft-pi-reborn/pipeline/head This commit looks good Details

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 set -e
# All Feature Flags # All Feature Flags
export AVAILABLE_FEATURES="$(echo \ export AVAILABLE_FEATURES="$(tr '\n' ' ' < /usr/share/minecraft-pi/client/features)"
"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'")"
# Print Feature Flags Option # Print Feature Flags Option
if [ "$1" = "--print-features" ]; then 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 # Ensure Features Are Selected
if [ -z "${MCPI_FEATURES+x}" ]; then 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 fi
if [ -z "${MCPI_USERNAME+x}" ]; then if [ -z "${MCPI_USERNAME+x}" ]; then
MCPI_USERNAME="$(zenity --class "${ZENITY_CLASS}" --entry --text 'Minecraft Username:' --entry-text 'StevePi')" 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 mkdir -p /tmp/minecraft-pi
# Start Logging # Start Logging
LOG="$(mktemp -u)" touch /tmp/minecraft-pi/main.log
mkfifo "${LOG}" tail -f /tmp/minecraft-pi/main.log &
tee /tmp/minecraft-pi/main.log < "${LOG}" & TAIL_PID=$!
TEE_PID=$!
# Run # Run
set +e 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=$? RET=$?
set -e set -e
# Kill Logging # Kill Logging
kill ${TEE_PID} kill ${TAIL_PID}
rm "${LOG}"
# Handle Crash # Handle Crash
if [ $RET -ne 0 ]; then 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.' 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 exit ${RET}
fi 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'