From 6a9944cdd93bdbbf54f9c670630cb7a94c55a6e5 Mon Sep 17 00:00:00 2001 From: Nicolas Pierron Date: Wed, 27 Aug 2008 13:59:33 +0000 Subject: [PATCH] pcmcia-utils: - Fix udev rules. - Accept multiple firmwares. - Allow redefinition of arguments. svn path=/nixpkgs/trunk/; revision=12741 --- .../os-specific/linux/pcmciautils/default.nix | 20 +++++++++++-------- pkgs/top-level/all-packages.nix | 5 +++-- 2 files changed, 15 insertions(+), 10 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; diff --git a/pkgs/top-level/all-packages.nix b/pkgs/top-level/all-packages.nix index d018c3c5f409..d26b99563e82 100644 --- a/pkgs/top-level/all-packages.nix +++ b/pkgs/top-level/all-packages.nix @@ -5419,12 +5419,13 @@ let inherit stdenv fetchurl pam libxcrypt; }; - pcmciaUtils = (import ../os-specific/linux/pcmciautils) { + pcmciaUtils = composedArgsAndFun (import ../os-specific/linux/pcmciautils) { inherit stdenv fetchurl udev yacc flex; inherit sysfsutils module_init_tools; - firmware = getConfig ["pcmciaUtils" "firmware"] null; + firmware = getConfig ["pcmciaUtils" "firmware"] []; config = getConfig ["pcmciaUtils" "config"] null; + inherit lib; }; powertop = import ../os-specific/linux/powertop {