about summary refs log tree commit diff
path: root/pkgs/games/dwarf-fortress/dwarf-therapist
diff options
context:
space:
mode:
authorMorgan Jones <me@numin.it>2018-07-15 03:58:37 +0000
committerMorgan Jones <me@numin.it>2018-09-09 06:59:41 +0000
commitf14d3b4795c173f5ff353031b8d32afab7090ab9 (patch)
tree0f10c1a662c9e738b0b3e540d48402224b03e5be /pkgs/games/dwarf-fortress/dwarf-therapist
parent4ada74e293212434114ac87a679c1432650f4b40 (diff)
downloadnixlib-f14d3b4795c173f5ff353031b8d32afab7090ab9.tar
nixlib-f14d3b4795c173f5ff353031b8d32afab7090ab9.tar.gz
nixlib-f14d3b4795c173f5ff353031b8d32afab7090ab9.tar.bz2
nixlib-f14d3b4795c173f5ff353031b8d32afab7090ab9.tar.lz
nixlib-f14d3b4795c173f5ff353031b8d32afab7090ab9.tar.xz
nixlib-f14d3b4795c173f5ff353031b8d32afab7090ab9.tar.zst
nixlib-f14d3b4795c173f5ff353031b8d32afab7090ab9.zip
Fix dfhack's Dwarf Fortress MD5 in the correct environment
Diffstat (limited to 'pkgs/games/dwarf-fortress/dwarf-therapist')
-rw-r--r--pkgs/games/dwarf-fortress/dwarf-therapist/wrapper.nix18
1 files changed, 12 insertions, 6 deletions
diff --git a/pkgs/games/dwarf-fortress/dwarf-therapist/wrapper.nix b/pkgs/games/dwarf-fortress/dwarf-therapist/wrapper.nix
index f86ef4bea7ab..6e3a13692a72 100644
--- a/pkgs/games/dwarf-fortress/dwarf-therapist/wrapper.nix
+++ b/pkgs/games/dwarf-fortress/dwarf-therapist/wrapper.nix
@@ -30,11 +30,17 @@ in symlinkJoin {
     # Fix up memory layouts
     rm -rf $out/share/dwarftherapist/memory_layouts/linux
     mkdir -p $out/share/dwarftherapist/memory_layouts/linux
-    origmd5=$(cat "${dwarf-fortress}/hash.md5.orig" | cut -c1-8)
-    patchedmd5=$(cat "${dwarf-fortress}/hash.md5" | cut -c1-8)
-    substitute \
-      ${dwarf-therapist}/share/dwarftherapist/memory_layouts/${inifile} \
-      $out/share/dwarftherapist/memory_layouts/${inifile} \
-      --replace "$origmd5" "$patchedmd5"
+    orig_md5=$(cat "${dwarf-fortress}/hash.md5.orig" | cut -c1-8)
+    patched_md5=$(cat "${dwarf-fortress}/hash.md5" | cut -c1-8)
+    input_file="${dwarf-therapist}/share/dwarftherapist/memory_layouts/${inifile}"
+    output_file="$out/share/dwarftherapist/memory_layouts/${inifile}"
+
+    echo "[Dwarf Therapist Wrapper] Fixing Dwarf Fortress MD5 prefix:"
+    echo "  Input:   $input_file"
+    echo "  Search:  $orig_md5"
+    echo "  Output:  $output_file"
+    echo "  Replace: $patched_md5"
+
+    substitute "$input_file" "$output_file" --replace "$orig_md5" "$patched_md5"
   '';
 }