summary refs log tree commit diff
path: root/pkgs/os-specific/linux/pcmciautils
diff options
context:
space:
mode:
authorNicolas Pierron <nicolas.b.pierron@gmail.com>2008-08-27 13:59:33 +0000
committerNicolas Pierron <nicolas.b.pierron@gmail.com>2008-08-27 13:59:33 +0000
commit6a9944cdd93bdbbf54f9c670630cb7a94c55a6e5 (patch)
treee14c24e172488d6b6f0206f9c0c619046c2e4614 /pkgs/os-specific/linux/pcmciautils
parentae163f596e369abb9679d0efd2b1a782979a6cb1 (diff)
downloadnixlib-6a9944cdd93bdbbf54f9c670630cb7a94c55a6e5.tar
nixlib-6a9944cdd93bdbbf54f9c670630cb7a94c55a6e5.tar.gz
nixlib-6a9944cdd93bdbbf54f9c670630cb7a94c55a6e5.tar.bz2
nixlib-6a9944cdd93bdbbf54f9c670630cb7a94c55a6e5.tar.lz
nixlib-6a9944cdd93bdbbf54f9c670630cb7a94c55a6e5.tar.xz
nixlib-6a9944cdd93bdbbf54f9c670630cb7a94c55a6e5.tar.zst
nixlib-6a9944cdd93bdbbf54f9c670630cb7a94c55a6e5.zip
pcmcia-utils:
- Fix udev rules.
- Accept multiple firmwares.
- Allow redefinition of arguments.

svn path=/nixpkgs/trunk/; revision=12741
Diffstat (limited to 'pkgs/os-specific/linux/pcmciautils')
-rw-r--r--pkgs/os-specific/linux/pcmciautils/default.nix20
1 files changed, 12 insertions, 8 deletions
diff --git a/pkgs/os-specific/linux/pcmciautils/default.nix b/pkgs/os-specific/linux/pcmciautils/default.nix
index e17d1135373c..a8b885d8a944 100644
--- a/pkgs/os-specific/linux/pcmciautils/default.nix
+++ b/pkgs/os-specific/linux/pcmciautils/default.nix
@@ -3,6 +3,7 @@
 , sysfsutils, module_init_tools, udev
 , firmware # Special pcmcia cards.
 , config   # Special hardware (map memory & port & irq)
+, lib      # used to generate postInstall script.
 }:
 
 # FIXME: should add an option to choose between hotplug and udev.
@@ -18,7 +19,7 @@ stdenv.mkDerivation rec {
 
   patchPhase = ''
     sed -i "
-      s,/sbin/modprobe,$module_init_tools/sbin/modprobe,;
+      s,/sbin/modprobe,${module_init_tools}&,;
       s,/lib/udev/,$out/sbin/,;
     " udev/* # fix-color */
     sed -i "
@@ -26,18 +27,21 @@ stdenv.mkDerivation rec {
       s,/etc/pcmcia,$out&,;
     " src/{startup.c,pcmcia-check-broken-cis.c} # fix-color */
   ''
-  + (if firmware == null then ''sed -i "s,STARTUP = true,STARTUP = false," Makefile'' else "")
+  + (if firmware == [] then ''sed -i "s,STARTUP = true,STARTUP = false," Makefile'' else "")
   + (if config == null then "" else ''
-    ln -sf ${config}/config.opts ./config/config.opts'')
+    ln -sf ${config} ./config/config.opts'')
   ;
 
   makeFlags = "LEX=flex";
   installFlags = ''INSTALL=install DESTDIR=''${out}'';
-  postInstall = 
-    (if firmware == null then "" else ''
-    ensureDir $out/lib
-    ln -s ${firmware} $out/lib/firmware'')
-    ;
+  postInstall =
+    lib.concatMapStrings (path: ''
+      for f in : $(find ${path} -type f); do
+        test "$f" == ":" && continue;
+        ensureDir $(dirname $out/lib/firmware/$\{f#${path}});
+        ln -s $f $out/lib/firmware/$\{f#${path}};
+      done;
+    '') firmware;
 
   meta = {
     homepage = http://kernel.org/pub/linux/utils/kernel/pcmcia/pcmcia.html;