summaryrefslogtreecommitdiffstats
path: root/lib/MGA/DrakISO/BuildBoot.pm
diff options
context:
space:
mode:
Diffstat (limited to 'lib/MGA/DrakISO/BuildBoot.pm')
-rwxr-xr-xlib/MGA/DrakISO/BuildBoot.pm86
1 files changed, 43 insertions, 43 deletions
diff --git a/lib/MGA/DrakISO/BuildBoot.pm b/lib/MGA/DrakISO/BuildBoot.pm
index 52fff4f..fc0f3fa 100755
--- a/lib/MGA/DrakISO/BuildBoot.pm
+++ b/lib/MGA/DrakISO/BuildBoot.pm
@@ -38,29 +38,29 @@ our @EXPORT = qw(prepare_live_system_boot prepare_iso_bootloader);
###############################################################################
sub prepare_live_system_boot {
- my ($live) = @_;
+ my ($build) = @_;
# Create a build directory. This will contain all the files we need to
# exist in /boot on the ISO.
- my $boot_dir = $live->get_builddir('boot');
+ my $boot_dir = $build->get_builddir('boot');
mkdir_p($boot_dir);
# Locate the kernel we want to boot.
- my $kernel = $live->find_kernel;
+ my $kernel = $build->find_kernel;
print "Using kernel $kernel->{version}\n";
# Copy the kernel into the build directory.
- my $vmlinuz = $live->get_system_root . '/boot/vmlinuz-' . $kernel->{version};
+ my $vmlinuz = $build->get_system_root . '/boot/vmlinuz-' . $kernel->{version};
-e $vmlinuz or die "cannot find kernel $kernel->{version} in root system\n";
cp_f($vmlinuz, $boot_dir . '/vmlinuz');
# Build an initrd suitable for Live boot.
- my $initrd = $live->get_system_root . '/boot/' . $live->get_initrd_name;
+ my $initrd = $build->get_system_root . '/boot/' . $build->get_initrd_name;
unlink($initrd);
{
my $bootloader = {};
- local $::prefix = $live->get_system_root;
- bootloader::add_kernel($bootloader, $kernel, { label => 'linux', vga => $live->{system}{vga_mode} }, '', $live->{system}{no_initrd});
+ local $::prefix = $build->get_system_root;
+ bootloader::add_kernel($bootloader, $kernel, { label => 'linux', vga => $build->{system}{vga_mode} }, '', $build->{system}{no_initrd});
}
# Move the initrd into the build directory.
@@ -72,15 +72,15 @@ sub prepare_live_system_boot {
###############################################################################
sub prepare_iso_bootloader {
- my ($live) = @_;
+ my ($build) = @_;
# Create a subdirectory to hold the grub2 bootloader.
- my $grub2_dir = $live->get_builddir('boot') . '/grub2';
+ my $grub2_dir = $build->get_builddir('boot') . '/grub2';
mkdir_p($grub2_dir);
# Locate and copy the default font for the bootloader. If we can't find a
# font, don't worry - the bootloader will fall back to text mode.
- my $font = $live->get_absolute_path($live->{media}{bootloader_font});
+ my $font = $build->get_absolute_path($build->{media}{bootloader_font});
if (defined $font) {
-e $font or die "cannot find bootloader font file $font\n";
} else {
@@ -95,7 +95,7 @@ sub prepare_iso_bootloader {
# Locate and copy the bootloader theme. Default to the standard Mageia
# theme if the user hasn't specified one. If that's not available either,
# proceed without a theme.
- my $theme = $live->get_absolute_path($live->{media}{bootloader_theme});
+ my $theme = $build->get_absolute_path($build->{media}{bootloader_theme});
if (defined $theme) {
-d $theme or die "cannot find bootloader theme directory $theme\n";
} else {
@@ -113,10 +113,10 @@ sub prepare_iso_bootloader {
# If the user has provided the necessary configuration data, construct
# the bootloader language and keyboard selection submenus and copy the
# grub2 keyboard layout files.
- my $add_lang_menu = defined $live->{media}{bootloader_langs};
- my $add_kbd_menu = defined $live->{media}{bootloader_kbds};
+ my $add_lang_menu = defined $build->{media}{bootloader_langs};
+ my $add_kbd_menu = defined $build->{media}{bootloader_kbds};
if ($add_lang_menu) {
- my $lang_names = $live->get_absolute_path($live->{media}{bootloader_langs});
+ my $lang_names = $build->get_absolute_path($build->{media}{bootloader_langs});
-e $lang_names or die "cannot find bootloader language name file $lang_names\n";
my @langs = group_by2(eval(cat_($lang_names))) or die "error in language name file $lang_names\n";
@@ -129,7 +129,7 @@ sub prepare_iso_bootloader {
MDK::Common::File::output_utf8($grub2_dir . '/lang-menu.cfg', build_lang_menu_cfg(\@langs, %$kbds));
}
if ($add_kbd_menu) {
- my $kbd_names = $live->get_absolute_path($live->{media}{bootloader_kbds});
+ my $kbd_names = $build->get_absolute_path($build->{media}{bootloader_kbds});
-e $kbd_names or die "cannot find bootloader keyboard name file $kbd_names\n";
my @kbds = group_by2(eval(cat_($kbd_names))) or die "error in keyboard name file $kbd_names\n";
@@ -141,7 +141,7 @@ sub prepare_iso_bootloader {
}
# Copy any message translation files the user has provided.
- my $messages = $live->get_absolute_path($live->{media}{bootloader_messages});
+ my $messages = $build->get_absolute_path($build->{media}{bootloader_messages});
if (defined $messages) {
-d $messages or die "cannot find bootloader messages directory $messages\n";
my $locale_dir = $grub2_dir . '/locale';
@@ -151,7 +151,7 @@ sub prepare_iso_bootloader {
# If the user has supplied a grub2 image for non-UEFI boot, copy that,
# otherwise build one.
- my $eltorito_img = $live->get_absolute_path($live->{media}{eltorito_img});
+ my $eltorito_img = $build->get_absolute_path($build->{media}{eltorito_img});
if (defined $eltorito_img) {
-e $eltorito_img or die "cannot find El Torito boot image $eltorito_img\n";
cp_f($eltorito_img, $grub2_dir . '/eltorito.img');
@@ -159,19 +159,19 @@ sub prepare_iso_bootloader {
build_grub2_eltorito_img($grub2_dir . '/eltorito.img');
}
- my $label = $live->{media}->get_media_label;
+ my $label = $build->{media}->get_media_label;
# If the user has supplied a top-level grub2 configuration file, copy that
# (replacing the "VOLUME_LABEL" template with the actual label for the ISO
# image), otherwise build one.
my $grub2_cfg = $grub2_dir . '/grub.cfg';
- if (defined $live->{media}{grub2_cfg}) {
- my $grub_cfg_template = $live->get_absolute_path($live->{media}{grub2_cfg});
+ if (defined $build->{media}{grub2_cfg}) {
+ my $grub_cfg_template = $build->get_absolute_path($build->{media}{grub2_cfg});
-e $grub_cfg_template or die "cannot find grub2 config file $grub_cfg_template\n";
cp_f($grub_cfg_template, $grub2_cfg);
run_("sed", "-i", "s/VOLUME_LABEL/$label/g", $grub2_cfg);
} else {
- output($grub2_cfg, build_grub2_cfg($live, $theme_name, \@theme_fonts, $add_lang_menu, $add_kbd_menu));
+ output($grub2_cfg, build_grub2_cfg($build, $theme_name, \@theme_fonts, $add_lang_menu, $add_kbd_menu));
}
my $title = $label =~ s/-/ /gr;
@@ -185,17 +185,17 @@ sub prepare_iso_bootloader {
# If we are building a 32-bit ISO, we are done, as we don't support
# 32-bit UEFI boot.
- return if $live->{settings}{arch} ne 'x86_64';
+ return if $build->{settings}{arch} ne 'x86_64';
# Create another build directory. This will contain all the files we need
# to exist in the /EFI directory on the ISO.
- my $efi_root_dir = $live->get_builddir('EFI');
+ my $efi_root_dir = $build->get_builddir('EFI');
my $efi_boot_dir = $efi_root_dir . '/BOOT';
mkdir_p($efi_boot_dir);
# If the user has supplied a grub2 image for UEFI boot, copy that,
# otherwise build one.
- my $bootx64_efi = $live->get_absolute_path($live->{media}{bootx64_efi});
+ my $bootx64_efi = $build->get_absolute_path($build->{media}{bootx64_efi});
if (defined $bootx64_efi) {
-e $bootx64_efi or die "cannot find EFI boot image $bootx64_efi\n";
cp_f($bootx64_efi, $efi_boot_dir . '/bootx64.efi');
@@ -205,7 +205,7 @@ sub prepare_iso_bootloader {
# Build a grub2 configuration file for UEFI boot. This just chains to the
# main grub2 configuration file.
- output($efi_boot_dir . '/grub.cfg', build_uefi_grub2_cfg($live));
+ output($efi_boot_dir . '/grub.cfg', build_uefi_grub2_cfg($build));
# If we have a theme, duplicate the theme configuration file and modify the
# title string to indicate we are doing a UEFI boot. This is useful when
@@ -217,7 +217,7 @@ sub prepare_iso_bootloader {
}
# Create another build directory for temporarily storing the ESP image.
- my $images_dir = $live->get_builddir('images');
+ my $images_dir = $build->get_builddir('images');
mkdir_p($images_dir);
# Construct an ESP image. This is needed for USB boot.
@@ -256,7 +256,7 @@ sub build_grub2_bootx64_efi {
}
sub build_grub2_cfg {
- my ($live, $theme_name, $theme_fonts, $add_lang_menu, $add_kbd_menu) = @_;
+ my ($build, $theme_name, $theme_fonts, $add_lang_menu, $add_kbd_menu) = @_;
my @loadfonts;
if (defined $theme_name) {
@@ -267,7 +267,7 @@ sub build_grub2_cfg {
join("\n",
"if [ -z \$initialised ] ; then",
- " search --no-floppy --set=root -l '" . $live->{media}->get_media_label . "'",
+ " search --no-floppy --set=root -l '" . $build->{media}->get_media_label . "'",
" set prefix=(\$root)/boot/grub2",
"",
" if loadfont \$prefix/fonts/unicode.pf2 ; then",
@@ -289,8 +289,8 @@ sub build_grub2_cfg {
" export initialised",
"fi",
"",
- "set default=" . get_bootloader_default($live),
- "set timeout=" . get_bootloader_timeout($live),
+ "set default=" . get_bootloader_default($build),
+ "set timeout=" . get_bootloader_timeout($build),
"",
if_($add_lang_menu,
"export lang",
@@ -305,11 +305,11 @@ sub build_grub2_cfg {
my ($name, $cmdline) = @$_;
join("\n",
"menuentry $gettext\"$name\" {",
- " linux /boot/vmlinuz " . get_default_append($live) . if_($cmdline, " $cmdline"),
+ " linux /boot/vmlinuz " . get_default_append($build) . if_($cmdline, " $cmdline"),
" initrd /boot/initrd.gz",
"}"
);
- } group_by2(@{$live->{media}{bootloader_entries}})),
+ } group_by2(@{$build->{media}{bootloader_entries}})),
if_($add_lang_menu || $add_kbd_menu,
# this acts as a spacer
"menuentry '________________________' {",
@@ -331,24 +331,24 @@ sub build_grub2_cfg {
}
sub get_bootloader_default {
- my ($live) = @_;
- defined $live->{media}{bootloader_default} ? $live->{media}{bootloader_default} : 0;
+ my ($build) = @_;
+ defined $build->{media}{bootloader_default} ? $build->{media}{bootloader_default} : 0;
}
sub get_bootloader_timeout {
- my ($live) = @_;
- defined $live->{media}{bootloader_timeout} ? $live->{media}{bootloader_timeout} : 4;
+ my ($build) = @_;
+ defined $build->{media}{bootloader_timeout} ? $build->{media}{bootloader_timeout} : 4;
}
sub get_default_append {
- my ($live) = @_;
- my $append = $live->{system}{append};
+ my ($build) = @_;
+ my $append = $build->{system}{append};
join(" ",
- "root=mgalive:LABEL=" . $live->{media}->get_media_label,
+ "root=mgalive:LABEL=" . $build->{media}->get_media_label,
"lang=\$lang kbd=\$kbd",
if_($append, $append),
- if_($live->{system}{vga_mode} && $append !~ /\bvga=\b/,
- "vga=" . $live->{system}{vga_mode}),
+ if_($build->{system}{vga_mode} && $append !~ /\bvga=\b/,
+ "vga=" . $build->{system}{vga_mode}),
);
}
@@ -405,9 +405,9 @@ sub build_kbd_menu_cfg {
}
sub build_uefi_grub2_cfg {
- my ($live) = @_;
+ my ($build) = @_;
join("\n",
- "search --no-floppy --set=root -l '" . $live->{media}->get_media_label . "'",
+ "search --no-floppy --set=root -l '" . $build->{media}->get_media_label . "'",
"set prefix=(\$root)/boot/grub2",
"",
"set uefi=true",