about summary refs log tree commit diff stats
diff options
context:
space:
mode:
-rwxr-xr-xdistribute.sh31
-rwxr-xr-xinstall.sh4
-rw-r--r--src/launch.sh8
3 files changed, 38 insertions, 5 deletions
diff --git a/distribute.sh b/distribute.sh
new file mode 100755
index 0000000..71bee81
--- /dev/null
+++ b/distribute.sh
@@ -0,0 +1,31 @@
+#!/bin/sh -xeu
+# This script will detect the OS, and try to grab the libraries. And then
+# creates a tarball for distribution.
+
+# Check if another config is being sourced.
+set +u
+if [ -z "$TUP_CONFIG" ];
+then
+	. ./tup.config
+else
+	. ./"$TUP_CONFIG"
+fi
+set -u
+
+mkdir -p "$CONFIG_INSTALL_PREFIX/libs"
+
+case "$(uname -s)" in
+
+	*)
+		# This is a catch all, above are specific loops for specific platforms.
+		for i in $(ldd "$CONFIG_BUILD_DIR"/bin/Pong* | awk '/usr/ {print $3}');
+		do
+			cp "$i" "$CONFIG_INSTALL_PREFIX/libs/"
+		done
+		;;
+esac
+cd "$CONFIG_INSTALL_PREFIX"
+rm libs/libGL* # Remove OpenGL as it conflicts with graphics drivers.
+
+# Tarball the finish result!
+bsdtar -caf ../Pong_"$(uname)-$(uname -r)-$(uname -m)".txz -- *
diff --git a/install.sh b/install.sh
index 564e708..7c0e174 100755
--- a/install.sh
+++ b/install.sh
@@ -2,11 +2,11 @@
 set -e
 
 # Check if another config is being sourced.
-if [ -z $TUP_CONFIG ];
+if [ -z "$TUP_CONFIG" ];
 then
 	. ./tup.config
 else
-	. ./$TUP_CONFIG
+	. ./"$TUP_CONFIG"
 fi
 
 set -u
diff --git a/src/launch.sh b/src/launch.sh
index 467bd26..1bec502 100644
--- a/src/launch.sh
+++ b/src/launch.sh
@@ -5,7 +5,8 @@ EXIT_STATUS=0
 TMPDIR=${TMPDIR:-/tmp}
 
 failed() {
-	zenity --error --text="The program appears to not have closed correctly. Please check output.log to see details."
+	ERROR_TEXT="The program appears to not have closed correctly. Please check output.log to see details."
+	zenity --error --text="$ERROR_TEXT" || echo "$ERROR_TEXT"
 	EXIT_STATUS=1
 }
 
@@ -13,12 +14,13 @@ run_game() {
 	PAYLOAD_LINE="$(awk '/^__PAYLOAD_BEGINS__/ { print NR + 1; exit 0; }' "$0")" || return 1
 	tail -n +"${PAYLOAD_LINE}" "$0" | xz -d > "$TMPFILE" || return 1
 	chmod +x "$TMPFILE" || return 1
-	DYLD_LIBRARY_PATH=libs/ LD_LIBARY_PATH=libs/ "$TMPFILE" > output.log 2>&1 || return 1
+	DYLD_LIBRARY_PATH=libs/ LD_LIBRARY_PATH=libs/ "$TMPFILE" > output.log 2>&1 || return 1
 	return 0
 }
 
 cd "$(dirname "$0")" || exit 1
-trap '{ rm -rf "$TMPFILE"; }' EXIT
+trap '{ rm -rf "$TMPFILE"; }' EXIT HUP INT QUIT TERM PWR
+
 if ! TMPFILE="./$(mktemp .Pong-XXXXXX)";
 then
 	echo "Can't extract Pong binary to current directory. Trying $TMPDIR"