[wolf4sdl] 01/01: Remove engine selection by means of alternatives (Closes: #775406).

Fabian Greffrath fabian-guest at moszumanska.debian.org
Thu Jan 15 13:09:03 UTC 2015


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

fabian-guest pushed a commit to branch master
in repository wolf4sdl.

commit 96152be3bceffc153f432c9063f08e3b1cb6a62f
Author: Fabian Greffrath <fabian+debian at greffrath.com>
Date:   Thu Jan 15 14:08:25 2015 +0100

    Remove engine selection by means of alternatives (Closes: #775406).
    
    Instead, provide a wrapper script that automatically runs the
    engine that fits to the data files found in '/usr/share/games/wolf3d'.
    Adjust documentation accordingly.
---
 debian/README.Debian              | 21 ++++----------
 debian/changelog                  |  4 +++
 debian/local/wolf4sdl             | 59 +++++++++++++++++++++++++++++++++++++++
 debian/man/wolf4sdl.6             |  5 ++--
 debian/wolf4sdl.install           |  1 +
 debian/wolf4sdl.lintian-overrides |  3 --
 debian/wolf4sdl.postinst          | 13 ---------
 debian/wolf4sdl.preinst           | 12 ++++++++
 debian/wolf4sdl.prerm             |  9 ------
 9 files changed, 83 insertions(+), 44 deletions(-)

diff --git a/debian/README.Debian b/debian/README.Debian
index 35eefdd..334aaec 100644
--- a/debian/README.Debian
+++ b/debian/README.Debian
@@ -3,28 +3,17 @@ Wolf4SDL for Debian
 
  * The wolf4sdl game requires additional data files which are not available
    under a free license and cannot be distributed by Debian. Thus, this package
-   contains no data files, but future releases of `game-data-packager' are
-   expected to be able to generate suitable data packages for wolf4sdl.
-   .
-   For the time being, it is required to obtain the data files from external
-   resources (hint: WolfGL home page, Files section) and copy them into the
-   `/usr/share/games/wolf3d' directory.
+   contains no data files, but 'game-data-packager' from version 27 onward is
+   able to generate suitable data packages for wolf4sdl.
 
  * The wolf4sdl package in Debian supports five variants of the game:
    Wolf3d Full v1.4 Apogee (with ReadThis), Wolf3d Full v1.4 GT/ID/Activision,
    Wolf3d Shareware v1.4, Spear of Destiny Full and Mission Disks, Spear of
    Destiny Demo. The corresponding binaries are named 'wolf4sdl-wl6a',
    'wolf4sdl-wl6', 'wolf4sdl-wl1', 'wolf4sdl-sod' and 'wolf4sdl-sdm',
-   respectively. In order to select which variant is started by the 'wolf4sdl'
-   command and the desktop and menu files, Debian's 'update-alternatives'
-   mechanism is used:
-   .
-   $ update-alternatives --config wolf4sdl
-   .
-   By default, the 'wolf4sdl-wl1' alternative is preferred.
+   respectively.
    .
-   The game expects its data files in the '/usr/share/games/wolf3d' directory
-   (with lower case file names), so make sure to also copy the appropriate data
-   files into this directory when changing the 'wolf4sdl' alternative.
+   The 'wolf4sdl' wrapper script automatically runs the engine that fits to the
+   data files found in '/usr/share/games/wolf3d'.
 
  -- Fabian Greffrath <fabian+debian at greffrath.com>  Mon, 03 Jan 2011 15:10:21 +0100
diff --git a/debian/changelog b/debian/changelog
index 3e23210..c63b9e5 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -4,6 +4,10 @@ wolf4sdl (1.7+svn262+dfsg1-3) UNRELEASED; urgency=low
   * Correctly disable silent builds.
   * Turn shading support into a command line option "--shading".
   * Show messages whenever autorun or autostrafe is toggled.
+  * Remove engine selection by means of alternatives (Closes: #775406).
+    Instead, provide a wrapper script that automatically runs the
+    engine that fits to the data files found in '/usr/share/games/wolf3d'.
+    Adjust documentation accordingly.
 
  -- Fabian Greffrath <fabian+debian at greffrath.com>  Wed, 25 Sep 2013 06:35:12 +0200
 
diff --git a/debian/local/wolf4sdl b/debian/local/wolf4sdl
new file mode 100755
index 0000000..e335234
--- /dev/null
+++ b/debian/local/wolf4sdl
@@ -0,0 +1,59 @@
+#!/bin/sh
+#
+# Copyright (C) 2015  Fabian Greffrath <fabian+debian at greffrath.com>
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2 of the License, or
+# (at your option) any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License along
+# with this program; if not, write to the Free Software Foundation, Inc.,
+# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+
+DATADIR=/usr/share/games/wolf3d
+ENGINE=
+
+file_matches()
+{
+  if [ -r "$DATADIR/$1" ] && \
+     [ `cksum "$DATADIR/$1" | cut -d ' ' -f 2` -eq $2 ]
+  then
+    return 1
+  else
+    return 0
+  fi
+}
+
+if `file_matches "vgagraph.wl6, 275774"`
+then
+  ENGINE=wolf4sdl-wl6
+else
+if `file_matches "vgagraph.wl6, 276096"`
+then
+  ENGINE=wolf4sdl-wl6
+else
+if `file_matches "vgagraph.wl6, 334506"`
+then
+  ENGINE=wolf4sdl-wl6a
+else
+if `file_matches "vgagraph.wl1, 326568"`
+then
+  ENGINE=wolf4sdl-wl1
+fi
+fi
+fi
+fi
+
+if [ -z "$ENGINE" ]
+then
+  echo "Could not find any supported data files in $DATADIR."
+  return 1
+else
+  exec "$ENGINE"
+fi
diff --git a/debian/man/wolf4sdl.6 b/debian/man/wolf4sdl.6
index 9c83809..2eb93e8 100644
--- a/debian/man/wolf4sdl.6
+++ b/debian/man/wolf4sdl.6
@@ -46,9 +46,8 @@ and
 .B Spear of Destiny Demo
 games, respectively. The
 .B wolf4sdl
-binary is a symbolic link to one of these and is handled via Debian's
-.B update-alternatives
-mechanism.
+wrapper script automatically runs the engine that fits to the data files found in
+.BR /usr/share/games/wolf3d .
 
 .SH OPTIONS
 .TP
diff --git a/debian/wolf4sdl.install b/debian/wolf4sdl.install
index 575af52..7ad65e2 100644
--- a/debian/wolf4sdl.install
+++ b/debian/wolf4sdl.install
@@ -1,4 +1,5 @@
 wolf4sdl-* usr/games
+debian/local/wolf4sdl usr/games
 debian/wolf4sdl.desktop usr/share/applications
 debian/wolf4sdl.png usr/share/icons/hicolor/32x32/apps
 debian/wolf4sdl.svg usr/share/icons/hicolor/scalable/apps
diff --git a/debian/wolf4sdl.lintian-overrides b/debian/wolf4sdl.lintian-overrides
deleted file mode 100644
index 0a10514..0000000
--- a/debian/wolf4sdl.lintian-overrides
+++ /dev/null
@@ -1,3 +0,0 @@
-# The /usr/games/wolf4sdl binary is handled via update-alternatives
-wolf4sdl: desktop-command-not-in-package
-wolf4sdl: menu-command-not-in-package
diff --git a/debian/wolf4sdl.postinst b/debian/wolf4sdl.postinst
deleted file mode 100644
index 5d550bf..0000000
--- a/debian/wolf4sdl.postinst
+++ /dev/null
@@ -1,13 +0,0 @@
-#!/bin/sh
-set -e
-
-if [ "$1" = "configure" ] || [ "$1" = "abort-upgrade" ]
-then
-  update-alternatives --quiet --install /usr/games/wolf4sdl wolf4sdl /usr/games/wolf4sdl-wl1  30
-  update-alternatives --quiet --install /usr/games/wolf4sdl wolf4sdl /usr/games/wolf4sdl-wl6  20
-  update-alternatives --quiet --install /usr/games/wolf4sdl wolf4sdl /usr/games/wolf4sdl-wl6a 20
-  update-alternatives --quiet --install /usr/games/wolf4sdl wolf4sdl /usr/games/wolf4sdl-sod  20
-  update-alternatives --quiet --install /usr/games/wolf4sdl wolf4sdl /usr/games/wolf4sdl-sdm  20
-fi
-
-#DEBHELPER#
diff --git a/debian/wolf4sdl.preinst b/debian/wolf4sdl.preinst
new file mode 100644
index 0000000..6db6216
--- /dev/null
+++ b/debian/wolf4sdl.preinst
@@ -0,0 +1,12 @@
+#!/bin/sh
+set -e
+
+if [ "$1" = "install" ] || [ "$1" = "upgrade" ]
+then
+  if dpkg --compare-versions "$2" lt-nl "1.7+svn262+dfsg1-3~"
+  then
+    update-alternatives --quiet --remove-all wolf4sdl
+  fi
+fi
+
+#DEBHELPER#
diff --git a/debian/wolf4sdl.prerm b/debian/wolf4sdl.prerm
deleted file mode 100644
index 0634892..0000000
--- a/debian/wolf4sdl.prerm
+++ /dev/null
@@ -1,9 +0,0 @@
-#!/bin/sh
-set -e
-
-if [ "$1" = "remove" ] || [ "$1" = "deconfigure" ]
-then
-  update-alternatives --quiet --remove-all wolf4sdl
-fi
-
-#DEBHELPER#

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



More information about the Pkg-games-commits mailing list