From 5bc7f9525bc3fefc1cd7b7ae9abfd0bcff296127 Mon Sep 17 00:00:00 2001 From: Olivier Blin Date: Thu, 13 Dec 2007 16:02:41 +0000 Subject: add inst_initrd_bin helper to copy binaries and their library dependencies --- draklive | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/draklive b/draklive index 47a9e88..0c9fee7 100755 --- a/draklive +++ b/draklive @@ -386,6 +386,16 @@ sub create_initrd { cp_f(get_builddir($live) . $live->{prefix}{build}{boot} . get_initrd_path($live->{media}), $live->{copy_initrd}) if $live->{copy_initrd}; } +sub inst_initrd_bin { + my ($root, $initrd_tree, $bin) = @_; + cp_f($root . $bin, $initrd_tree . '/bin/'); + foreach my $file (`chroot $root ldd $bin | awk '/\\// {if(\$2 == "=>") {print \$3} else {print \$1}}'`) { + my ($lib_prefix, $filename) = chomp_($file) =~ m|/(lib[^/]*).*/([^/]+)$| or next; + my $dest = $initrd_tree . '/' . $lib_prefix . '/' . $filename; + mkdir_p($initrd_tree . '/' . $lib_prefix); + cp_f($root . $file, $dest) if !-f $dest; + } +} sub create_initrd_for_media { my ($live, $media) = @_; @@ -445,10 +455,8 @@ sub create_initrd_for_media { } } - if (exists $storage_fs{$fs}{files}) { - cp_f(get_system_root($live) . $_, $initrd_tree . '/bin/') - foreach @{$storage_fs{$fs}{files} || []}; - } + inst_initrd_bin(get_system_root($live), $initrd_tree, $_) foreach + @{$storage_fs{$fs} && $storage_fs{$fs}{files} || []}; if ($live->{debug}) { $need_libs = 1; -- cgit v1.2.1