From 75d88bbdc0ff86c275852afdd513872e35ee58ce Mon Sep 17 00:00:00 2001 From: Olivier Blin Date: Thu, 13 Dec 2007 16:05:31 +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 e223a7e..a985ce0 100755 --- a/draklive +++ b/draklive @@ -381,6 +381,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) = @_; @@ -442,10 +452,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