summaryrefslogtreecommitdiffstats
path: root/lib/MDV/Draklive/Initrd.pm
diff options
context:
space:
mode:
Diffstat (limited to 'lib/MDV/Draklive/Initrd.pm')
-rw-r--r--lib/MDV/Draklive/Initrd.pm32
1 files changed, 17 insertions, 15 deletions
diff --git a/lib/MDV/Draklive/Initrd.pm b/lib/MDV/Draklive/Initrd.pm
index a2fe017..ff81307 100644
--- a/lib/MDV/Draklive/Initrd.pm
+++ b/lib/MDV/Draklive/Initrd.pm
@@ -53,7 +53,9 @@ sub inst_initrd_bin {
sub create_initrd_for_media {
my ($live, $media) = @_;
- my $lib_prefix = find { glob($live->get_system_root . $_ . '/libc.so.*') } qw(/lib64 /lib);
+ my $root = $live->get_system_root;
+
+ my $lib_prefix = find { glob($root . $_ . '/libc.so.*') } qw(/lib64 /lib);
$lib_prefix or die 'unable to find system libraries in /lib or /lib64';
my $initrd_tree = $live->get_builddir . $live->{prefix}{build}{initrd} . '/' . $media->{storage};
@@ -67,30 +69,30 @@ sub create_initrd_for_media {
map { $_->{mountpoint} } @{$live->{mount}{dirs} || []};
#- use nash with label support
- inst_initrd_bin($live->get_system_root, $initrd_tree, '/sbin/nash');
- inst_initrd_bin($live->get_system_root, $initrd_tree, '/usr' . $lib_prefix . '/drakx-installer-binaries/probe-modules');
- inst_initrd_bin($live->get_system_root, $initrd_tree, '/sbin/blockdev')
+ inst_initrd_bin($root, $initrd_tree, '/sbin/nash');
+ inst_initrd_bin($root, $initrd_tree, '/usr' . $lib_prefix . '/drakx-installer-binaries/probe-modules');
+ inst_initrd_bin($root, $initrd_tree, '/sbin/blockdev')
if $media->get_media_setting('rereadpt');
- inst_initrd_bin($live->get_system_root, $initrd_tree, '/usr/bin/strace')
+ inst_initrd_bin($root, $initrd_tree, '/usr/bin/strace')
if $live->{debug};
- foreach (chomp_(run_program::rooted_get_stdout($live->get_system_root, "/usr/sbin/splashy_find_files"))) {
- inst_initrd_file($live->get_system_root, $initrd_tree, $_);
+ foreach (chomp_(run_program::rooted_get_stdout($root, "/usr/sbin/splashy_find_files"))) {
+ inst_initrd_file($root, $initrd_tree, $_);
}
#- busybox is required to:
#- detect usb-storage process (we need sh/while/ps/grep)
#- mount loopbacks read-only with losetup (useful over NFS)
my $busybox = '/usr/bin/busybox';
- inst_initrd_bin($live->get_system_root, $initrd_tree, $busybox);
- my $busybox_rooted = $live->get_system_root . $busybox;
+ inst_initrd_bin($root, $initrd_tree, $busybox);
+ my $busybox_rooted = $root . $busybox;
my @l = map { /functions:/ .. /^$/ ? do { s/\s//g; split /,/ } : () } `$busybox_rooted`;
shift @l;
symlink('busybox', $initrd_tree . "/bin/$_") foreach @l;
my $fs = $media->get_media_setting('fs');
my @used_loop_types = uniq(map { $_->{type} } @{$live->{mount}{dirs}});
- inst_initrd_bin($live->get_system_root, $initrd_tree, $_) foreach
+ inst_initrd_bin($root, $initrd_tree, $_) foreach
MDV::Draklive::StorageFS::get_files($fs),
(map { @{$loop_types{$_} && $loop_types{$_}{files} || []} } @used_loop_types);
@@ -113,7 +115,7 @@ sub create_initrd_for_media {
my $kernel = $live->find_kernel;
print "using kernel $kernel\n";
my $kernel_root = "/lib/modules/" . $kernel;
- list_modules::load_dependencies($live->get_system_root . $kernel_root . "/modules.dep");
+ list_modules::load_dependencies($root . $kernel_root . "/modules.dep");
my ($storage_modules, $skipped) = partition { list_modules::modname2filename($_) }
uniq(map { modules::cond_mapping_24_26($_) } category2modules($media->get_media_setting('modules')));
@@ -141,7 +143,7 @@ sub create_initrd_for_media {
foreach my $m (@modules_closure) {
my $full = list_modules::modname2path($m);
mkdir_p(dirname($initrd_tree . $full));
- cp_f($live->get_system_root . $full, $initrd_tree . $full);
+ cp_f($root . $full, $initrd_tree . $full);
}
foreach my $f (@{$live->{system}{additional_modules}}) {
my $destdir = $initrd_tree . $kernel_root . "/kernel";
@@ -156,10 +158,10 @@ sub create_initrd_for_media {
mkdir_p($initrd_tree . "/etc/blkid"); #- for nash and showlabels cache
mkdir_p($initrd_tree . "/lib/module-init-tools");
- cp_f($live->get_system_root . "/lib/module-init-tools/ldetect-lst-modules.alias", $initrd_tree . "/lib/module-init-tools");
+ cp_f($root . "/lib/module-init-tools/ldetect-lst-modules.alias", $initrd_tree . "/lib/module-init-tools");
mkdir_p($initrd_tree . "/usr/share/ldetect-lst");
- cp_f($live->get_system_root . "/usr/share/pci.ids", $initrd_tree . "/usr/share");
- cp_f($live->get_system_root . "/usr/share/ldetect-lst/" . $_, $initrd_tree . "/usr/share/ldetect-lst")
+ cp_f($root . "/usr/share/pci.ids", $initrd_tree . "/usr/share");
+ cp_f($root . "/usr/share/ldetect-lst/" . $_, $initrd_tree . "/usr/share/ldetect-lst")
foreach qw(fallback-modules.alias pcitable.gz usbtable.gz);
@$skipped and print STDERR "skipped modules: " . join(' ', sort(@$skipped)) . "\n";