r2077 - in trunk: . data
DONOTREPLY at icculus.org
DONOTREPLY at icculus.org
Sun Dec 31 06:01:55 EST 2006
Author: div0
Date: 2006-12-31 06:01:55 -0500 (Sun, 31 Dec 2006)
New Revision: 2077
Modified:
trunk/data/default.cfg
trunk/nexuiz-linux-glx.sh
trunk/nexuiz-linux-sdl.sh
Log:
new cvar vid_x11_display for use by nexuiz-linux-*.sh
Modified: trunk/data/default.cfg
===================================================================
--- trunk/data/default.cfg 2006-12-30 18:41:38 UTC (rev 2076)
+++ trunk/data/default.cfg 2006-12-31 11:01:55 UTC (rev 2077)
@@ -81,6 +81,13 @@
scr_menuforcewhiledisconnected 1
v_deathtilt 0 // needed for spectators (who are dead to avoid prediction)
+// nexuiz-linux-*.sh will use this
+seta vid_x11_display ""
+// This can have three possible settings:
+// "" run as usual
+// ":n" use DISPLAY=:n, create it if needed
+// ":n layout" use DISPLAY=:n, create it if needed with ServerLayout layout
+
// server settings
seta hostname "Nexuiz Server"
seta sv_maxrate 10000
Modified: trunk/nexuiz-linux-glx.sh
===================================================================
--- trunk/nexuiz-linux-glx.sh 2006-12-30 18:41:38 UTC (rev 2076)
+++ trunk/nexuiz-linux-glx.sh 2006-12-31 11:01:55 UTC (rev 2077)
@@ -11,4 +11,80 @@
*) nexuiz="nexuiz-linux-686-glx" ;;
esac
-exec ./${nexuiz} "${@}"
+set -- ./${nexuiz} "${@}"
+
+xserver=
+xlayout=
+
+# now how do we execute it?
+if [ -r ~/.nexuiz/data/config.cfg ]; then
+ while read -r CMD KEY VALUE; do
+ VALUE=${VALUE#\"}
+ VALUE=${VALUE%\"}
+ case "$CMD:$KEY" in
+ seta:vid_x11_display)
+ case "$VALUE" in
+ :*)
+ ;;
+ *)
+ VALUE=:$VALUE
+ ;;
+ esac
+ VALUE="$VALUE "
+ xserver="${VALUE%% *}"
+ xserver=${xserver#:}
+ xlayout=${VALUE#* }
+ xlayout=${xlayout% }
+ ;;
+ esac
+ done < ~/.nexuiz/data/config.cfg
+fi
+
+case "$xserver" in
+ '')
+ ;;
+ *[!0-9]*)
+ echo "Not using display ':$xserver': evil characters"
+ ;;
+ *)
+ msg=
+ lf='
+'
+ prefix=
+
+ # check for a listening X server on that socket
+ if netstat -nl | grep -F " /tmp/.X11-unix/X$xserver" >/dev/null; then
+ # X server already exists
+ export DISPLAY=:$xserver
+ prefix="DISPLAY=:$xserver "
+ msg=$msg$lf"- Running Nexuiz on already existing display :$xserver"
+ else
+ set -- startx "$@" -- ":$xserver"
+ msg=$msg$lf"- Running Nexuiz on a newly created X server :$xserver."
+ case "$xlayout" in
+ '')
+ ;;
+ *[!A-Za-z0-9]*)
+ echo >&2 "Not using layout '$xlayout': evil characters"
+ xlayout=
+ ;;
+ *)
+ set -- "$@" -layout "$xlayout"
+ msg=$msg$lf"- Using the ServerLayout section named $xlayout."
+ ;;
+ esac
+ fi
+
+ echo "X SERVER OVERRIDES IN EFFECT:$msg"
+ echo
+ echo "Resulting command line:"
+ echo " $prefix$*"
+ echo
+ echo "To undo these overrides, edit ~/.nexuiz/data/config.cfg and remove the line"
+ echo "starting with 'seta vid_x11_display'."
+ echo
+ echo
+ ;;
+esac
+
+exec "$@"
Modified: trunk/nexuiz-linux-sdl.sh
===================================================================
--- trunk/nexuiz-linux-sdl.sh 2006-12-30 18:41:38 UTC (rev 2076)
+++ trunk/nexuiz-linux-sdl.sh 2006-12-31 11:01:55 UTC (rev 2077)
@@ -11,4 +11,80 @@
*) nexuiz="nexuiz-linux-686-sdl" ;;
esac
-exec ./${nexuiz} "${@}"
+set -- ./${nexuiz} "${@}"
+
+xserver=
+xlayout=
+
+# now how do we execute it?
+if [ -r ~/.nexuiz/data/config.cfg ]; then
+ while read -r CMD KEY VALUE; do
+ VALUE=${VALUE#\"}
+ VALUE=${VALUE%\"}
+ case "$CMD:$KEY" in
+ seta:vid_x11_display)
+ case "$VALUE" in
+ :*)
+ ;;
+ *)
+ VALUE=:$VALUE
+ ;;
+ esac
+ VALUE="$VALUE "
+ xserver="${VALUE%% *}"
+ xserver=${xserver#:}
+ xlayout=${VALUE#* }
+ xlayout=${xlayout% }
+ ;;
+ esac
+ done < ~/.nexuiz/data/config.cfg
+fi
+
+case "$xserver" in
+ '')
+ ;;
+ *[!0-9]*)
+ echo "Not using display ':$xserver': evil characters"
+ ;;
+ *)
+ msg=
+ lf='
+'
+ prefix=
+
+ # check for a listening X server on that socket
+ if netstat -nl | grep -F " /tmp/.X11-unix/X$xserver" >/dev/null; then
+ # X server already exists
+ export DISPLAY=:$xserver
+ prefix="DISPLAY=:$xserver "
+ msg=$msg$lf"- Running Nexuiz on already existing display :$xserver"
+ else
+ set -- startx "$@" -- ":$xserver"
+ msg=$msg$lf"- Running Nexuiz on a newly created X server :$xserver."
+ case "$xlayout" in
+ '')
+ ;;
+ *[!A-Za-z0-9]*)
+ echo >&2 "Not using layout '$xlayout': evil characters"
+ xlayout=
+ ;;
+ *)
+ set -- "$@" -layout "$xlayout"
+ msg=$msg$lf"- Using the ServerLayout section named $xlayout."
+ ;;
+ esac
+ fi
+
+ echo "X SERVER OVERRIDES IN EFFECT:$msg"
+ echo
+ echo "Resulting command line:"
+ echo " $prefix$*"
+ echo
+ echo "To undo these overrides, edit ~/.nexuiz/data/config.cfg and remove the line"
+ echo "starting with 'seta vid_x11_display'."
+ echo
+ echo
+ ;;
+esac
+
+exec "$@"
More information about the nexuiz-commits
mailing list