[SCM] Installer for game data files branch, quake, updated. 4241631553516ba7ca05e6cd1c71f8368fb5bf16

Jon Dowland jmtd at debian.org
Tue Apr 26 18:58:16 UTC 2011


The following commit has been merged in the quake branch:
commit 3a9dbf412699f3fd413138a60e945bd6729f5d41
Author: Jon Dowland <jmtd at debian.org>
Date:   Tue Apr 26 19:46:20 2011 +0100

    quake: case-insensitive search for data files
    
    DOS/Windows filesystems are case insensitive and a user pointing
    gdp at such a filesystem (or files copied from one) might have
    game data files using a mixture of cases (e.g. id1/pak0.pak;
    Id1/PAK0.PAK, etc.)
    
    Look for game data in a case-insensitive way (but be careful to
    insert game data into .deb files in lower-case only.)

diff --git a/lib/game-data-packager-shared b/lib/game-data-packager-shared
index 8a1740c..490685b 100644
--- a/lib/game-data-packager-shared
+++ b/lib/game-data-packager-shared
@@ -262,3 +262,11 @@ gdp_unzip() {
         unzip -qqo "$zipfile" "$@"
     fi
 }
+
+## ifind(base,file)
+##      case-insensitive search for file in base
+ifind() {
+  base="$1"
+  file="$2"
+  find "$base" -iwholename "$base/$file"
+}
diff --git a/supported/quake b/supported/quake
index 66ea3b2..6f5227a 100644
--- a/supported/quake
+++ b/supported/quake
@@ -82,7 +82,7 @@ go() {
 }
 
 guess_method() {
-    if [ -f "$mountpoint/id1/pak0.pak" ]; then
+    if ifind "$mountpoint" "id1/pak0.pak" >/dev/null; then
         debug "treating $mountpoint like an installed directory"
         method="dir"
         dir_method
@@ -141,9 +141,8 @@ cdrom_method() {
 }
 
 dir_method() {
-    # XXX: do clever things with case etc. here
-    pak0="$mountpoint/id1/pak0.pak"
-    pak1="$mountpoint/id1/pak1.pak"
+    pak0=$(ifind "$mountpoint" "id1/pak0.pak" | head -1)
+    pak1=$(ifind "$mountpoint" "id1/pak1.pak" | head -1)
     # Presume the directory contains version 1.06
     pak0sum=5906e5998fc3d896ddaf5e6a62e03abb
     pak1sum=d76b3e5678f0b64ac74ce5e340e6a685
@@ -212,10 +211,17 @@ common_method() {
     OUTFILE=`unravel "$OUTDIR"`"/$DEBBASE"
     cp -p "$DATADIR/$DEBBASE" "$OUTFILE"
 
+    # force lower case for our copy of the files
+    ln -s "$pak0" "$WORKDIR/pak0.pak"
+    ln -s "$pak1" "$WORKDIR/pak1.pak"
+
     if [ "$pak1" = "" ]; then
-        slipstream "$OUTFILE" "usr/share/games/quake/${folder}/" "$pak0"
+        slipstream "$OUTFILE" "usr/share/games/quake/${folder}/" \
+            "$WORKDIR/pak0.pak"
     else
-        slipstream "$OUTFILE" "usr/share/games/quake/${folder}/" "$pak0" "$pak1"
+        slipstream "$OUTFILE" "usr/share/games/quake/${folder}/" \
+            "$WORKDIR/pak0.pak" "$WORKDIR/pak1.pak"
     fi
     [ -d "$WORKDIR/${folder}" ] && rm -rf "$WORKDIR/${folder}"
+    rm "$WORKDIR/pak0.pak" "$WORKDIR/pak1.pak"
 }

-- 
Installer for game data files



More information about the Pkg-games-commits mailing list