[chocolate-doom] 02/02: chocolate-update-menus: doom,strife,hexen

Jonathan Dowland jmtd at moszumanska.debian.org
Mon Jan 23 17:52:59 UTC 2017


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

jmtd pushed a commit to branch chocolate-update-menus
in repository chocolate-doom.

commit bebac7ec82e17c8cbe2c950f46ac78128671221e
Author: Jonathan Dowland <jmtd at debian.org>
Date:   Mon Jan 23 17:52:11 2017 +0000

    chocolate-update-menus: doom,strife,hexen
    
    Basic parameterisation so the update-menus script can be used for
    the other engines.
---
 debian/chocolate-update-menus | 50 ++++++++++++++++++++++++++++---------------
 1 file changed, 33 insertions(+), 17 deletions(-)

diff --git a/debian/chocolate-update-menus b/debian/chocolate-update-menus
index 142fa63..74e07c1 100755
--- a/debian/chocolate-update-menus
+++ b/debian/chocolate-update-menus
@@ -14,23 +14,39 @@ paths=("/usr/local/share/games/doom" "/usr/share/games/doom")
 if [[ $EUID -ne 0 ]]; then
     prefix="${XDG_DATA_HOME-$HOME/.local/share}"
     dst="$prefix/applications"
-    paths=("$prefix/games/doom" "${paths[@]}")
+    paths=(
+        "$prefix/games/doom"
+        "${paths[@]}"
+    )
 fi
 
-name=chocolate-heretic.desktop
-
-for path in "${paths[@]}"; do
-    # glob either expands to any case (heretic.wad, HERETIC.WAD, etc.) or doesn't expand
-    for wad in "$path/heretic.wad"*; do
-        if [ -f "$wad" ]; then
-            mkdir -p "$dst"
-            cp "$src/$name" "$dst"
-            exit 0
-        fi
-        break
+zomg() {
+    local name="$1"
+    shift
+    while [ $# -gt 0 ]; do
+        local wadname="$1"
+        shift
+        for path in "${paths[@]}"; do
+            # glob either expands to any case (heretic.wad, HERETIC.WAD, etc.) or doesn't expand
+            for wad in "$path/$wadname"*; do
+                if [ -f "$wad" ]; then
+                    mkdir -p "$dst"
+                    cp "$src/$name" "$dst"
+                    return
+                fi
+                break
+            done
+        done
     done
-done
-# XXX: ensure not locally modified first
-if [ -f "$dst/$name" ]; then
-    rm "$dst/$name"
-fi
+    # XXX: ensure not locally modified first
+    # Or not. System paths are for the system; behave differently in uid!=0 mode?
+    if [ -f "$dst/$name" ]; then
+        rm "$dst/$name"
+    fi
+}
+
+zomg "chocolate-heretic.desktop" "heretic.wad" "heretic1.wad"
+zomg "chocolate-hexen.desktop" "hexen.wad"
+zomg "chocolate-strife.desktop" "strife1.wad"
+zomg "chocolate-doom.desktop" "doom.wad" "doom2.wad" "doom1.wad" "tnt.wad" "plutonia.wad"
+# XXX hacx.wad, chex.wad?

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



More information about the Pkg-games-commits mailing list