diff options
Diffstat (limited to 'lib/MGA/DrakISO/BuildBoot.pm')
-rw-r--r-- | lib/MGA/DrakISO/BuildBoot.pm | 27 |
1 files changed, 16 insertions, 11 deletions
diff --git a/lib/MGA/DrakISO/BuildBoot.pm b/lib/MGA/DrakISO/BuildBoot.pm index ed3347c..276217b 100644 --- a/lib/MGA/DrakISO/BuildBoot.pm +++ b/lib/MGA/DrakISO/BuildBoot.pm @@ -51,6 +51,8 @@ our @EXPORT = qw(prepare_live_system_boot prepare_iso_bootloader); sub prepare_live_system_boot { my ($build) = @_; + my $root = $build->get_system_root; + # Create a build directory. This will contain all the files we need to # exist in /boot on the ISO. my $boot_dir = $build->get_builddir('boot'); @@ -61,21 +63,24 @@ sub prepare_live_system_boot { print "Using kernel $kernel->{version}\n"; # Copy the kernel into the build directory. - my $vmlinuz = $build->get_system_root . '/boot/vmlinuz-' . $kernel->{version}; - -e $vmlinuz or die "ERROR: cannot find kernel $kernel->{version} in root system\n"; - cp_f($vmlinuz, $boot_dir . '/vmlinuz'); + my $vmlinuz = '/boot/vmlinuz-' . $kernel->{version}; + -e $root . $vmlinuz or die "ERROR: cannot find kernel $kernel->{version} in root system\n"; + cp_f($root . $vmlinuz, $boot_dir . '/vmlinuz'); # Build an initrd suitable for Live boot. - my $initrd = $build->get_system_root . '/boot/' . $build->get_initrd_name; - unlink($initrd); - { - my $bootloader = {}; - local $::prefix = $build->get_system_root; - bootloader::add_kernel($bootloader, $kernel, { label => 'linux', vga => $build->{system}{vga_mode} }, '', $build->{system}{no_initrd}); - } + my $initrd = '/boot/' . $build->get_initrd_name; + run_in_root($root, undef, 'mkinitrd', '-f', if_($::verbose < 3, '-q'), $initrd, $kernel->{version}) + or die "ERROR: cannot create initrd\n"; + run_as_root('chmod', '644', $root . $initrd) + or die "ERROR: cannot chmod initrd\n"; # Move the initrd into the build directory. - mv($initrd, $boot_dir . '/initrd.gz') or die "ERROR: cannot move initrd: $!\n"; + run_as_root('mv', $root . $initrd, $boot_dir . '/initrd.gz') + or die "ERROR: cannot move initrd\n"; + + # Remove anything written to /dev/null. We haven't mounted the /dev + # filesystem, so this will just be an ordinary file. + run_as_root('rm', $root . '/dev/null') if -f $root . '/dev/null'; } ############################################################################### |