diff options
author | Pascal Rigaux <pixel@mandriva.com> | 2005-01-25 12:43:27 +0000 |
---|---|---|
committer | Pascal Rigaux <pixel@mandriva.com> | 2005-01-25 12:43:27 +0000 |
commit | 39db082e96ed2a11eb6d97d219981916e96c04ea (patch) | |
tree | 9d6220513e7e0214ac91aef10da546e485a2f5aa /make_boot_img | |
parent | 6e26a68ac4ca4e192e80c8512d19333a64b6efd0 (diff) | |
download | drakx-backup-do-not-use-39db082e96ed2a11eb6d97d219981916e96c04ea.tar drakx-backup-do-not-use-39db082e96ed2a11eb6d97d219981916e96c04ea.tar.gz drakx-backup-do-not-use-39db082e96ed2a11eb6d97d219981916e96c04ea.tar.bz2 drakx-backup-do-not-use-39db082e96ed2a11eb6d97d219981916e96c04ea.tar.xz drakx-backup-do-not-use-39db082e96ed2a11eb6d97d219981916e96c04ea.zip |
- factorize code in syslinux_cfg()
- change the data structure returned by entries_append()
Diffstat (limited to 'make_boot_img')
-rwxr-xr-x | make_boot_img | 76 |
1 files changed, 40 insertions, 36 deletions
diff --git a/make_boot_img b/make_boot_img index f41de9154..87b3528b2 100755 --- a/make_boot_img +++ b/make_boot_img @@ -128,6 +128,28 @@ sub syslinux_msg { . "\n" . syslinux_color('red') . "[F1-Help] [F2-Advanced Help] [F3-Main]" . syslinux_color('default') . "\n"; } +sub syslinux_cfg { + my ($timeout, $entries) = @_; + + my $header = <<EOF; +default linux +prompt 1 +timeout $timeout +display boot.msg +F1 help.msg +F2 advanced.msg +F3 boot.msg +EOF + + my @l = map { + "label $_->{label}\n" . + " kernel $_->{kernel}\n" . + ($_->{initrd} ? " append initrd=$_->{initrd} $_->{append}\n" : ''); + } @$entries; + + $header . join('', @l); +} + sub install_stripped { _ "strip $_[0]"; _ "$sudo install $_[0] $_[1]" } sub initrd { @@ -206,7 +228,7 @@ sub entries_append { if_($type eq "all", all => "pcmcia $default_vga $default_acpi"), ); - map { [ $_->[0], "$default_append $_->[1]" ] } + map { { label => $_->[0], append => "$default_append $_->[1]" } } group_by2(@entries); } @@ -231,20 +253,11 @@ sub boot_img_i386 { initrd($tmp_mnt_initrd, $initrd_type, $I, $rdz); my $short_type = substr($type, 0, 8); - my $timeout = 72; - output "$mnt/syslinux.cfg", -"default linux -prompt 1 -timeout $timeout -display boot.msg -F1 help.msg -F2 advanced.msg -F3 boot.msg -" . join('', map { -"label $_->[0] - kernel vmlinuz - append initrd=$short_type.rdz $_->[1] -" } entries_append($type)); + output("$mnt/syslinux.cfg", + syslinux_cfg(72, #- timeout + [ map { + { kernel => 'vmlinuz', initrd => "$short_type.rdz", %$_ }; + } entries_append($type) ])); eval { _ "cp -f $rdz $mnt/$short_type.rdz" }; if ($@) { @@ -692,27 +705,18 @@ sub isolinux { _ "cp /usr/lib/syslinux/isolinux.bin isolinux/isolinux.bin"; _ "install -m 644 -D /boot/memtest* isolinux/test/memtest.bin"; - output "isolinux/isolinux.cfg", " -default linux -prompt 1 -timeout 150 -display boot.msg -F1 help.msg -F2 advanced.msg -F3 boot.msg -" . join('', map { -"label $_->[0] - kernel alt0/vmlinuz - append initrd=alt0/all.rdz $_->[1] automatic=method:cdrom -" } entries_append('all')) - . join('', map_index { -"label alt$::i - kernel alt$::i/vmlinuz - append initrd=alt$::i/all.rdz $default_append $default_acpi $default_vga -" } @kernels) . -"label memtest - kernel test/memtest.bin -"; + output("isolinux/isolinux.cfg", + syslinux_cfg(150, [ + (map { + { label => $_->{label}, kernel => 'alt0/vmlinuz', initrd => 'alt0/all.rdz', + append => "$_->{append} automatic=method:cdrom" }; + } entries_append('all')), + (map_index { + { label => "alt$::i", kernel => "alt$::i/vmlinuz", initrd => "alt$::i/all.rdz", + append => "$default_append $default_acpi $default_vga" }; + } @kernels), + { label => 'memtest', kernel => 'test/memtest.bin' }, + ])); output("isolinux/help.msg", syslinux_msg('help.msg.xml')); output("isolinux/advanced.msg", syslinux_msg('advanced.msg.xml', |