From 63555aa270059488b013e6c802cca64a8d6eebdc Mon Sep 17 00:00:00 2001 From: Martin Whitaker Date: Tue, 9 Jan 2018 23:17:35 +0000 Subject: 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. --- lib/MGA/DrakISO/BuildBoot.pm | 27 ++++++++++++++++----------- 1 file changed, 16 insertions(+), 11 deletions(-) (limited to 'lib/MGA/DrakISO/BuildBoot.pm') 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'; } ############################################################################### -- cgit v1.2.1