Ver código fonte

fix(ins): make srcds_run launchable on Ubuntu (#5154)

Fix Insurgency's srcds_run launcher on Ubuntu.

Strip CRLF line endings and use Bash for the launcher, which needs pushd/popd. Reapply the fix after game updates.

Fixes #5153
Daniel Gibbs 1 dia atrás
pai
commit
fb5dbd8023
1 arquivos alterados com 7 adições e 2 exclusões
  1. 7 2
      lgsm/modules/fix_ins.sh

+ 7 - 2
lgsm/modules/fix_ins.sh

@@ -8,13 +8,18 @@
 moduleselfname="$(basename "$(readlink -f "${BASH_SOURCE[0]}")")"
 
 # Fixes: ./srcds_linux: error while loading shared libraries: libtier0.so: cannot open shared object file: No such file or directory.
-
 export LD_LIBRARY_PATH="$LD_LIBRARY_PATH:${serverfiles}:${serverfiles}/bin"
 
 # Fixes: issue #529 - gamemode not passed to debug or start.
-
 if [ "${commandname}" == "DEBUG" ]; then
 	defaultmap="\"${defaultmap}\""
 else
 	defaultmap="\\\"${defaultmap}\\\""
 fi
+
+# Fixes: srcds_run is shipped with CRLF line endings and a /bin/sh shebang but needs bash (pushd/popd).
+if [ -f "${serverfiles}/srcds_run" ]; then
+	if grep -q $'\r' "${serverfiles}/srcds_run" || head -n 1 "${serverfiles}/srcds_run" | grep -q '^#!/bin/sh'; then
+		sed -i 's/\r$//;1s|^#!/bin/sh$|#!/bin/bash|' "${serverfiles}/srcds_run"
+	fi
+fi