[game-data-packager] 131/293: add check for missing data

Simon McVittie smcv at debian.org
Fri Oct 14 00:12:06 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 fa8e1495fa25557672c8dfc65345b5b9b500fe43
Author: David Banks <amoebae at gmail.com>
Date:   Tue Jun 14 16:28:24 2011 +0100

    add check for missing data
---
 debian/copyright     | 14 ++++++++++++++
 debian/quake.install |  1 +
 need-data.sh         | 48 ++++++++++++++++++++++++++++++++++++++++++++++++
 quake.sh             |  6 ++++++
 4 files changed, 69 insertions(+)

diff --git a/debian/copyright b/debian/copyright
index 94634ec..ba41bc1 100644
--- a/debian/copyright
+++ b/debian/copyright
@@ -9,3 +9,17 @@ Files: quake.png
 Copyright: 2007 Rodney Dawes 
 License: GPL-2
  Please refer to the file '/usr/share/common-licenses/GPL-2' on Debian systems.
+
+Files: need-data.sh
+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
+  terms of the GNU General Public License, Version 2, or any later version
+  published by the Free Software Foundation.
+  .
+  On Debian systems, the complete text of the GNU General Public License can
+  be found in /usr/share/common-licenses/GPL-2.
diff --git a/debian/quake.install b/debian/quake.install
index 370fb4d..0ccd393 100644
--- a/debian/quake.install
+++ b/debian/quake.install
@@ -1,3 +1,4 @@
 quake          /usr/games
+need-data.sh   /usr/share/games/quake
 quake.desktop  /usr/share/applications
 quake.xpm      /usr/share/pixmaps
diff --git a/need-data.sh b/need-data.sh
new file mode 100755
index 0000000..69412ae
--- /dev/null
+++ b/need-data.sh
@@ -0,0 +1,48 @@
+#!/bin/sh
+
+TITLE="Quake"
+TEXT="$1"
+
+try_zenity () {
+  if command -v zenity >/dev/null; then
+    zenity --error --text="$TEXT" --title="$TITLE"
+    return 0
+  else
+    return 1
+  fi
+}
+
+try_kdialog () {
+  if command -v kdialog >/dev/null; then
+    kdialog --error --text="$TEXT" --title="$TITLE"
+    return 0
+  else
+    return 1
+  fi
+}
+
+try_xmessage () {
+  if command -v xmessage >/dev/null; then
+    xmessage -center -buttons OK "$TEXT"
+    return 0
+  else
+    return 1
+  fi
+}
+
+case $(echo "$DESKTOP_SESSION" | tr A-Z a-z) in
+  (kde)
+    pref=try_kdialog
+    ;;
+  (gnome)
+    pref=try_zenity
+    ;;
+  (*)
+    pref=false
+    ;;
+esac
+
+$pref || try_zenity || try_kdialog || try_xmessage
+
+printf "%s\n" "$TEXT"
+exit 72         # EX_OSFILE
diff --git a/quake.sh b/quake.sh
index e059cec..22fe0f1 100644
--- a/quake.sh
+++ b/quake.sh
@@ -5,4 +5,10 @@
 data_location=/usr/share/games/quake
 engine_path=/usr/games/quakespasm
 
+no_data_msg="Missing data; see /usr/share/doc/quake/README.Debian"
+
+if ! [ -f "${data_location}/id1/pak0.pak" ]; then
+    exec "$data_location"/need-data.sh "$no_data_msg"
+fi
+
 exec ${engine_path} -basedir ${data_location}

-- 
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