copy only cryptsetup deps to stage-1 and test cryptsetup

popt-0.16 and cryptsetup-1.4.1 both generated pkgconfig (in contrast
to older versions). The pkgconfig files (popt.pc and cryptsetup.pc)
contain references into the store that are not removed by patchelf and
stage-1 fails with errors like: "output is not allowed to refer to
path `/nix/store/qccjhn063cfv171rcaxvxh0yk96zf7l2-cryptsetup-1.4.1'".

Now, only the cryptsetup binaries and its dependencies are copied,
determined by ldd. In addition the cryptsetup binary and lvm are
tested after patchelf has adjusted the library paths.

Thanks to Peter Simons and Eelco Dolstra for giving the rights hints.

svn path=/nixos/trunk/; revision=31128
This commit is contained in:
Florian Friesdorf 2011-12-28 21:46:40 +00:00
parent d98ecd1d9e
commit dd8e725d7d

View File

@ -28,10 +28,20 @@ in
config = mkIf (luksRoot != "") {
# copy the cryptsetup binary and it's dependencies
boot.initrd.extraUtilsCommands = ''
cp -r ${pkgs.cryptsetup}/lib/* $out/lib/
cp -r ${pkgs.popt}/lib/* $out/lib
cp ${pkgs.cryptsetup}/sbin/* $out/bin
cp -pdv ${pkgs.cryptsetup}/sbin/cryptsetup $out/bin
# XXX: do we have a function that does this?
for lib in $(ldd $out/bin/cryptsetup |grep '=>' |grep /nix/store/ |cut -d' ' -f3); do
cp -pdvn $lib $out/lib
cp -pvn $(readlink -f $lib) $out/lib
done
'';
boot.initrd.extraUtilsCommandsTest = ''
$out/bin/cryptsetup --version
$out/bin/lvm vgscan --version
$out/bin/lvm vgchange --version
'';
boot.initrd.postDeviceCommands = ''