From 6a9944cdd93bdbbf54f9c670630cb7a94c55a6e5 Mon Sep 17 00:00:00 2001 From: Nicolas Pierron Date: Wed, 27 Aug 2008 13:59:33 +0000 Subject: pcmcia-utils: - Fix udev rules. - Accept multiple firmwares. - Allow redefinition of arguments. svn path=/nixpkgs/trunk/; revision=12741 --- pkgs/os-specific/linux/pcmciautils/default.nix | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) (limited to 'pkgs/os-specific/linux/pcmciautils') 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; -- cgit 1.4.1