summaryrefslogtreecommitdiffstats
path: root/lib/MGA/DrakISO/BuildBoot.pm
diff options
context:
space:
mode:
authorMartin Whitaker <mageia@martin-whitaker.me.uk>2018-01-09 23:17:35 +0000
committerMartin Whitaker <mageia@martin-whitaker.me.uk>2018-01-09 23:17:35 +0000
commit63555aa270059488b013e6c802cca64a8d6eebdc (patch)
tree75c481453e459dc2aea279a86eb89ceedfd0ecf1 /lib/MGA/DrakISO/BuildBoot.pm
parent71146812d733fdc46abe1d77b7d68f9859cdc124 (diff)
downloaddrakiso-63555aa270059488b013e6c802cca64a8d6eebdc.tar
drakiso-63555aa270059488b013e6c802cca64a8d6eebdc.tar.gz
drakiso-63555aa270059488b013e6c802cca64a8d6eebdc.tar.bz2
drakiso-63555aa270059488b013e6c802cca64a8d6eebdc.tar.xz
drakiso-63555aa270059488b013e6c802cca64a8d6eebdc.zip
draklive: allow installer GUI to be used and run as normal user.
Read all configuration from the main config file and automatically generate the auto_inst.cfg.pl file. Run the installer GUI in a nested X server if any items are not specified in the config file. Use sudo to run any steps that need root privileges, to avoid running the X server as root.
Diffstat (limited to 'lib/MGA/DrakISO/BuildBoot.pm')
-rw-r--r--lib/MGA/DrakISO/BuildBoot.pm27
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';
}
###############################################################################