slightly improved xonotic-linux-sdl.sh

This commit is contained in:
Dr. Jaska 2023-05-26 06:03:31 +00:00 committed by bones_was_here
parent 40e9169d05
commit aa22414d70

View File

@ -1,10 +1,10 @@
#!/bin/sh #!/bin/sh
path=`dirname "${0}"` path=$(dirname "${0}")
link=`readlink -f "${0}"` link=$(readlink -f "${0}")
[ -n "${link}" ] && path=`dirname "${link}"` [ -n "${link}" ] && path=$(dirname "${link}")
cd "${path}" cd "${path}" || exit 1
case "${0##*/}" in case "${0##*/}" in
*dedicated*) mode="dedicated" ;; *dedicated*) mode="dedicated" ;;
@ -12,15 +12,15 @@ case "${0##*/}" in
*) mode="sdl" ;; *) mode="sdl" ;;
esac esac
case "$(uname -m)" in case $(uname):$(uname -m) in
i?86) arch="linux32" ;; # Not supported anymore but you can build your own. Linux:x86_64) arch="linux64" ;;
*) arch="linux64" ;; *) arch="local" ;; # Not pre-built but you can build your own
esac esac
# prefer locally built binary if available (see: Makefile) # prefer locally built binary if available (see: Makefile)
xonotic="xonotic-local-${mode}" xonotic="xonotic-local-${mode}"
[ -x "$xonotic" ] || xonotic="xonotic-${arch}-${mode}" [ -x "$xonotic" ] || xonotic="xonotic-${arch}-${mode}"
echo "Executing: $xonotic ${@}" echo "Executing: $xonotic ${*}"
set -- ./${xonotic} "${@}" set -- ./${xonotic} "${@}"
@ -122,4 +122,14 @@ case "$xserver" in
;; ;;
esac 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