From 7b89f7604f9c4a5953618b4161ab5d2cec9d4996 Mon Sep 17 00:00:00 2001 From: TheBrokenRail Date: Thu, 28 Jan 2021 17:04:54 -0500 Subject: [PATCH] Simplify Startup Scripts --- debian/client/common/usr/bin/minecraft-pi | 19 ++----------------- .../common/usr/lib/minecraft-pi/pre-launch.sh | 18 ++++++++---------- .../usr/share/minecraft-pi/client/features | 15 +++++++++++++++ 3 files changed, 25 insertions(+), 27 deletions(-) create mode 100644 debian/client/common/usr/share/minecraft-pi/client/features diff --git a/debian/client/common/usr/bin/minecraft-pi b/debian/client/common/usr/bin/minecraft-pi index 2e93ca176..b9325285b 100755 --- a/debian/client/common/usr/bin/minecraft-pi +++ b/debian/client/common/usr/bin/minecraft-pi @@ -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')" diff --git a/debian/client/common/usr/lib/minecraft-pi/pre-launch.sh b/debian/client/common/usr/lib/minecraft-pi/pre-launch.sh index 88459b641..4301c980a 100755 --- a/debian/client/common/usr/lib/minecraft-pi/pre-launch.sh +++ b/debian/client/common/usr/lib/minecraft-pi/pre-launch.sh @@ -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 \ No newline at end of file diff --git a/debian/client/common/usr/share/minecraft-pi/client/features b/debian/client/common/usr/share/minecraft-pi/client/features new file mode 100644 index 000000000..10c49cd34 --- /dev/null +++ b/debian/client/common/usr/share/minecraft-pi/client/features @@ -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'