return if errcp(sys("$tool $path $tmp/initrd_mnt/sbin")) == 2;
}
# Testing if init is sufficient for grabbing the correct libraries for the
# executables immediately above. This could be modified to test a
# list of executables. Now bzip2 uses libbz2.so.1.0, so if bzip2 is
# present on the system this will be the tester instead, and size
# has to be figured out differently.
info(0, ".. the libs\n");
# Testing if init is sufficient for grabbing the correct libraries for the
# executables immediately above. This could be modified to test a
# list of executables. Now bzip2 uses libbz2.so.1.0, so if bzip2 is
# present on the system this will be the tester instead, and size
# has to be figured out differently.
info(0, ".. the libs\n");
my $lib_tester;
if ($bz2_toggle->active && -x find_file_in_path("bzip2") ) {
my $lib_tester;
if ($bz2_toggle->active && -x find_file_in_path("bzip2") ) {
$lib_tester = find_file_in_path("bzip2");
$lib_tester = find_file_in_path("bzip2");
}
else {
$lib_tester = find_file_in_path("init");
}
my $dir;
open(L,"ldd $lib_tester|") or die "Oops, no $lib_tester could be found :)\n"; # safe to use ldd, this is going to be fixed later with library_dependencies
while (<L>) {
my $place;
($lib,$place) = (split(/=>/,$_))[0,1];
$place = (split(" ",$place))[0];
$lib =~ s/\s+//;
$lib = basename($lib);
$lib =~ s/\s+$//;
$dir = dirname($place);
info(0,"$dir/$lib\n");
open (SL,"ls -l $dir/$lib|") or die "humm: $!\n";
while (<SL>) {
# symbolic link
if (-l "$dir/$lib") {
$what = (split(/\s+/,$_))[10];
($path,$value) = stripper("$dir/$lib","lib");
$value == 0 ? ($tool = "cp -a") : ($tool = "mv");
return if errcp(sys("$tool $path $tmp/initrd_mnt$dir")) == 2;
($path,$value) = stripper("$dir/$what","lib");
$value == 0 ? ($tool = "cp -a") : ($tool = "mv");
return if errcp(sys("$tool $path $tmp/initrd_mnt$dir")) == 2;
}
# no symbolic link
else {
($path,$value) = stripper("$dir/$lib","lib");
return if errcp(sys("cp -a $path $tmp/initrd_mnt$dir")) == 2;
}
}
}
} # not busybox
}
else {
$lib_tester = find_file_in_path("init");
my $error;
}
# busybox binary
$tool = "cp -a";
$path = "/home/mttrader/busybox/busybox/busybox";
return if errcp(sys("$tool $path $tmp/initrd_mnt/sbin")) == 2;
open(L,"ldd $lib_tester|") or die "Oops, no $lib_tester could be found :)\n"; # safe to use ldd, this is going to be fixed later with library_dependencies
while (<L>) {
my $place;
($lib,$place) = (split(/=>/,$_))[0,1];
$place = (split(" ",$place))[0];
$lib =~ s/\s+//;
$lib = basename($lib);
$lib =~ s/\s+$//;
$dir = dirname($place);
info(0,"$dir/$lib\n");
open (SL,"ls -l $dir/$lib|") or die "humm: $!\n";
while (<SL>) {
# symbolic link
if (-l "$dir/$lib") {
$what = (split(/\s+/,$_))[10];
($path,$value) = stripper("$dir/$lib","lib");
$value == 0 ? ($tool = "cp -a") : ($tool = "mv");
return if errcp(sys("$tool $path $tmp/initrd_mnt$dir")) == 2;
($path,$value) = stripper("$dir/$what","lib");
$value == 0 ? ($tool = "cp -a") : ($tool = "mv");
return if errcp(sys("$tool $path $tmp/initrd_mnt$dir")) == 2;
}
# no symbolic link
else {
($path,$value) = stripper("$dir/$lib","lib");
return if errcp(sys("cp -a $path $tmp/initrd_mnt$dir")) == 2;
}
}
}
info(0, "Determine run-time link bindings\n");
# Has a return code of 0 regardless
# Also, produces false alarms even when it is working.