]> git.xonotic.org Git - xonotic/xonotic.git/commitdiff
slightly improved xonotic-linux-sdl.sh
authorDr. Jaska <drjaska83@gmail.com>
Fri, 26 May 2023 06:03:31 +0000 (06:03 +0000)
committerbones_was_here <bones_was_here@xonotic.au>
Fri, 26 May 2023 06:03:31 +0000 (06:03 +0000)
xonotic-linux-sdl.sh

index f96c83f9d0af0ed70632c8e1c517f1a0875c4b13..bec83477f0dc65f5bd66a3ca6e76d38b59645b85 100755 (executable)
@@ -1,26 +1,26 @@
 #!/bin/sh
 
-path=`dirname "${0}"`
-link=`readlink -f "${0}"`
+path=$(dirname "${0}")
+link=$(readlink -f "${0}")
 
-[ -n "${link}" ] && path=`dirname "${link}"`
-cd "${path}"
+[ -n "${link}" ] && path=$(dirname "${link}")
+cd "${path}" || exit 1
 
 case "${0##*/}" in
-  *dedicated*) mode="dedicated" ;;
-  *glx*)       mode="glx" ;;
-  *)           mode="sdl" ;;
+  *dedicated*)  mode="dedicated" ;;
+  *glx*)        mode="glx" ;;
+  *)            mode="sdl" ;;
 esac
 
-case "$(uname -m)" in
-  i?86)        arch="linux32" ;;  # Not supported anymore but you can build your own.
-  *)   arch="linux64" ;;
+case $(uname):$(uname -m) in
+  Linux:x86_64)  arch="linux64" ;;
+  *)             arch="local"   ;;  # Not pre-built but you can build your own
 esac
 
 # prefer locally built binary if available (see: Makefile)
 xonotic="xonotic-local-${mode}"
 [ -x "$xonotic" ] || xonotic="xonotic-${arch}-${mode}"
-echo "Executing: $xonotic ${@}"
+echo "Executing: $xonotic ${*}"
 
 set -- ./${xonotic} "${@}"
 
@@ -122,4 +122,14 @@ case "$xserver" in
                ;;
 esac
 
-exec "$@"
+if which "$1" > /dev/null
+then
+       exec "$@"
+else
+       echo "Could not find $1 to exec"
+       if [ "$arch" = "local" ]
+       then
+               printf "%b\n%b\n" "Xonotic does not currently provide pre-built $(uname):$(uname -m) builds, please compile one using make" \
+                       "More info is available at \e[1;36mhttps://gitlab.com/xonotic/xonotic/-/wikis/Compiling\e[m"
+       fi
+fi