[game-data-packager] 116/293: Add a simple init script (disabled by default, so you don't have to use it if you prefer to run the server under screen or something), based on the one in tremulous-server

Simon McVittie smcv at debian.org
Fri Oct 14 00:12:04 UTC 2016


This is an automated email from the git hooks/post-receive script.

smcv pushed a commit to branch quake
in repository game-data-packager.

commit 104fe07a3d90c6d8bb12cc69a573288dfe792d95
Author: Simon McVittie <smcv at debian.org>
Date:   Thu Nov 11 01:18:31 2010 +0000

    Add a simple init script (disabled by default, so you don't have to use it if you prefer to run the server under screen or something), based on the one in tremulous-server
---
 debian/changelog              |  3 ++
 debian/control                |  3 +-
 debian/copyright              |  2 +
 debian/quake3-server.default  | 14 +++++++
 debian/quake3-server.init     | 89 +++++++++++++++++++++++++++++++++++++++++++
 debian/quake3-server.install  |  1 +
 debian/quake3-server.links    |  1 +
 debian/quake3-server.postinst | 24 ++++++++++++
 debian/quake3-server.postrm   |  9 +++++
 server.cfg                    | 28 ++++++++++++++
 10 files changed, 173 insertions(+), 1 deletion(-)

diff --git a/debian/changelog b/debian/changelog
index 76ba826..27840ee 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -6,6 +6,9 @@ quake3 (1.1) UNRELEASED; urgency=low
     or (as a last resort) terminal output to tell the user about
     game-data-packager
   * If quake3-data is missing from quake3-server, just output to the console
+  * Add a simple init script (disabled by default, so you don't have to use
+    it if you prefer to run the server under screen or something), based on
+    the one in tremulous-server
 
  -- Simon McVittie <smcv at debian.org>  Wed, 10 Nov 2010 21:35:01 +0000
 
diff --git a/debian/control b/debian/control
index 584ce41..ef089c0 100644
--- a/debian/control
+++ b/debian/control
@@ -26,7 +26,8 @@ Description: Quake III Arena menu entry and launcher scripts
 
 Package: quake3-server
 Architecture: all
-Depends: ioquake3-server,
+Depends: adduser,
+         ioquake3-server,
          quake3-data | game-data-packager (>= 23),
          ${misc:Depends}
 Description: Quake III Arena dedicated server launcher scripts
diff --git a/debian/copyright b/debian/copyright
index 5fc6dc3..c4378e9 100644
--- a/debian/copyright
+++ b/debian/copyright
@@ -9,7 +9,9 @@ Comment:
 
 Files: *
 Copyright:
+  © 2006 Damien Laniel
   © 2008 Jack Coulter
+  © 2008 Peter Eisentraut
   © 2010 Simon McVittie
 License: GPL-2+
   Permission is granted to copy, distribute and/or modify this work under the
diff --git a/debian/quake3-server.default b/debian/quake3-server.default
new file mode 100644
index 0000000..6bb40a2
--- /dev/null
+++ b/debian/quake3-server.default
@@ -0,0 +1,14 @@
+# Defaults for Quake III Arena init script
+# sourced by /etc/init.d/quake3-server
+# installed at /etc/default/quake3-server by the maintainer scripts
+
+# set to 1 to enable
+START_DAEMON=0
+
+# Additional options that are passed to the daemon.
+# Add "+set dedicated 2" here, or "set dedicated 2" in server.cfg, if you want
+# your server advertised on the public server list.
+#
+# debian_server.cfg is a symlink to /etc/quake3/server.cfg, so you can
+# use that file for system-wide configuration.
+DAEMON_OPTS="+exec debian_server.cfg"
diff --git a/debian/quake3-server.init b/debian/quake3-server.init
new file mode 100644
index 0000000..bd3e3ec
--- /dev/null
+++ b/debian/quake3-server.init
@@ -0,0 +1,89 @@
+#! /bin/sh
+### BEGIN INIT INFO
+# Provides:          quake3-server
+# Required-Start:    $remote_fs $network
+# Required-Stop:     $remote_fs $network
+# Default-Start:     2 3 4 5
+# Default-Stop:      0 1 6
+# Short-Description: Start Quake III Arena game server
+### END INIT INFO
+
+PATH="/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin"
+DAEMON="/usr/games/quake3-server"
+NAME="quake3-server"
+DESC="Quake III Arena dedicated server"
+PIDFILE="/var/run/$NAME.pid"
+BINARY="/usr/lib/ioquake3/ioq3ded"
+
+test -x $DAEMON || exit 0
+
+. /lib/lsb/init-functions
+
+# Include defaults if available
+if [ -f /etc/default/quake3-server ] ; then
+	. /etc/default/quake3-server
+fi
+
+q3_start() {
+    if [ -f $PIDFILE ]; then
+        return 2
+    fi
+    if [ "$START_DAEMON" != 1 ]; then
+        echo -n " (not starting - disabled in /etc/default/quake3-server)"
+        return 0
+    fi
+    start-stop-daemon --start --quiet --pidfile $PIDFILE --oknodo \
+	--background --exec $BINARY --startas $DAEMON \
+	--make-pidfile --chuid Debian-quake3 \
+	-- $DAEMON_OPTS > /dev/null 2>&1 || return 1
+    return 0
+}
+
+q3_stop() {
+    start-stop-daemon --stop --quiet --pidfile $PIDFILE \
+	--oknodo --exec $BINARY || return 1
+    rm -f $PIDFILE
+    return 0
+}
+
+case "$1" in
+    start)
+        log_begin_msg "Starting $DESC: $NAME"
+        q3_start
+        log_end_msg $?
+	;;
+    stop)
+        log_begin_msg "Stopping $DESC: $NAME"
+        q3_stop
+        log_end_msg $?
+	;;
+    #reload)
+	#
+	#	If the daemon can reload its config files on the fly
+	#	for example by sending it SIGHUP, do it here.
+	#
+	#	If the daemon responds to changes in its config file
+	#	directly anyway, make this a do-nothing entry.
+	#
+	# echo "Reloading $DESC configuration files."
+	# start-stop-daemon --stop --signal 1 --quiet --pidfile \
+	#	/var/run/$NAME.pid --exec $DAEMON
+        #;;
+    restart|force-reload)
+	#
+	#	If the "reload" option is implemented, move the "force-reload"
+	#	option to the "reload" entry above. If not, "force-reload" is
+	#	just the same as "restart".
+	#
+        log_begin_msg "Restarting $DESC: $NAME"
+        q3_stop && sleep 1 && q3_start
+        log_end_msg $?
+	;;
+    *)
+	# echo "Usage: $0 {start|stop|restart|reload|force-reload}" >&2
+	echo "Usage: $0 {start|stop|restart|force-reload}" >&2
+	exit 1
+	;;
+esac
+
+exit 0
diff --git a/debian/quake3-server.install b/debian/quake3-server.install
index 18acb36..8938c5d 100644
--- a/debian/quake3-server.install
+++ b/debian/quake3-server.install
@@ -1,2 +1,3 @@
+server.cfg etc/quake3-server
 build/quake3-server usr/games
 build/quake3-server.README.Debian usr/share/doc/quake3-server
diff --git a/debian/quake3-server.links b/debian/quake3-server.links
new file mode 100644
index 0000000..82ba523
--- /dev/null
+++ b/debian/quake3-server.links
@@ -0,0 +1 @@
+etc/quake3-server/server.cfg usr/share/games/quake3/baseq3/debian_server.cfg
diff --git a/debian/quake3-server.postinst b/debian/quake3-server.postinst
new file mode 100644
index 0000000..d676ee4
--- /dev/null
+++ b/debian/quake3-server.postinst
@@ -0,0 +1,24 @@
+#!/bin/sh
+
+set -e
+
+case "$1" in
+  configure)
+    if ! getent passwd Debian-quake3 >/dev/null; then
+      adduser --disabled-password --quiet --system \
+        --home /var/games/quake3-server --no-create-home \
+        --gecos "Quake III Arena dedicated server" \
+	--ingroup games --force-badname Debian-quake3
+    fi
+    install -d /var/games
+    install -d -o Debian-quake3 -g games /var/games/quake3-server
+  ;;
+  abort-upgrade|abort-remove|abort-deconfigure)
+  ;;
+  *)
+    echo "postinst called with unknown argument \`$1'" >&2
+    exit 1
+  ;;
+esac
+
+#DEBHELPER#
diff --git a/debian/quake3-server.postrm b/debian/quake3-server.postrm
new file mode 100644
index 0000000..a92de04
--- /dev/null
+++ b/debian/quake3-server.postrm
@@ -0,0 +1,9 @@
+#!/bin/sh
+
+set -e
+
+#DEBHELPER#
+
+if [ "$1" = "purge" ] ; then
+    deluser --quiet --system Debian-quake3 > /dev/null || true
+fi
diff --git a/server.cfg b/server.cfg
new file mode 100644
index 0000000..2dd8252
--- /dev/null
+++ b/server.cfg
@@ -0,0 +1,28 @@
+// Sample server configuration for Quake III Arena in Debian
+//
+// The Quake III Arena data includes some more elaborate examples:
+//
+// apt-get install unzip
+// unzip /usr/share/games/quake3/baseq3/pak0.pk3 \
+//     ctf.config ffa.config teamplay.config tourney.config gamecycle.config
+
+// set dedicated to 2 (default is 1) to advertise your server in the global
+// server list
+//set dedicated 2
+
+// name of your server
+//sv_hostname "An anonymous Debian server"
+
+// 0 = free-for-all deathmatch
+// 1 = tournament 1-on-1
+// 3 = team deathmatch
+// 4 = CTF
+g_gametype 0
+
+// Start this map first
+map q3dm2
+
+// You can use the exec command to run one of the example configurations
+// mentioned above, or your own configuration file in
+// /var/games/quake3-server/.q3a/baseq3:
+//exec ctf.config

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-games/game-data-packager.git



More information about the Pkg-games-commits mailing list