Make syslinux use built components
This commit is contained in:
parent
615c89e412
commit
7586dfb8d4
|
@ -173,34 +173,21 @@ if ( defined( $config{Components}{Copies} ) and ( $config{Components}{Copies} gt
|
|||
}
|
||||
}
|
||||
|
||||
if ( defined( $config{syslinux}{Copies} ) and ( $config{syslinux}{Copies} gt 0 ) ) {
|
||||
$runConf{kernel_target} =
|
||||
sprintf( "%s/%s-%s", $config{syslinux}{ImageDir}, $runConf{kernel_prefix}, $runConf{version} );
|
||||
$runConf{initramfs_target} = sprintf( "%s/initramfs-%s.img", $config{syslinux}{ImageDir}, $runConf{version} );
|
||||
if ( defined( $config{syslinux}{CreateConfig} ) and ( $config{syslinux}{CreateConfig} eq 1 ) ) {
|
||||
my $glob = sprintf( "%s/%s-*", $config{Components}{ImageDir}, $runConf{kernel_prefix} );
|
||||
my @listing = sort glob($glob);
|
||||
|
||||
my $glob = sprintf( "%s/%s-*", $config{syslinux}{ImageDir}, $runConf{kernel_prefix} );
|
||||
my @listing = sort glob($glob);
|
||||
print Dumper(@listing);
|
||||
|
||||
printf "Found %s existing images, allowed to have a total of %s\n", scalar @listing, $config{syslinux}{Copies};
|
||||
while ( scalar @listing > $config{syslinux}{Copies} ) {
|
||||
my $kernel = shift(@listing);
|
||||
my $initramfs = sprintf( "%s.img", $kernel );
|
||||
$initramfs =~ s/\Q$runConf{kernel_prefix}/initramfs/;
|
||||
printf "Removing %s, %s\n", $kernel, $initramfs;
|
||||
unlink $kernel;
|
||||
unlink $initramfs;
|
||||
# Filter EFI files and our target image
|
||||
my @components;
|
||||
foreach my $entry (@listing) {
|
||||
if ( $entry =~ /EFI$/i ) {
|
||||
next;
|
||||
}
|
||||
|
||||
make_path $config{syslinux}{ImageDir};
|
||||
if ( safeCopy( $runConf{kernel}, $runConf{kernel_target} )
|
||||
and safeCopy( $runConf{initramfs}, $runConf{initramfs_target} ) )
|
||||
{
|
||||
printf "Created %s, %s\n", $runConf{kernel_target}, $runConf{initramfs_target};
|
||||
push( @components, $entry );
|
||||
}
|
||||
|
||||
$glob = sprintf( "%s/%s-*", $config{syslinux}{ImageDir}, $runConf{kernel_prefix} );
|
||||
@listing = sort glob($glob);
|
||||
|
||||
$runConf{syslinux_temp} = join('/', $tempdir, 'syslinux.conf');
|
||||
open CFG, '>', $runConf{syslinux_temp};
|
||||
|
||||
|
@ -215,11 +202,14 @@ EOF
|
|||
print CFG $header;
|
||||
|
||||
my $add_default = 1;
|
||||
while (@listing) {
|
||||
my $entry = pop(@listing);
|
||||
while (@components) {
|
||||
my $entry = pop(@components);
|
||||
|
||||
my $directory = dirname( $entry );
|
||||
$directory =~ s/\Q$config{Global}{BootMountPoint}//;
|
||||
|
||||
my $kernel = basename( $entry );
|
||||
my (undef,$version) = split('-', basename( $kernel ));
|
||||
my (undef,$version) = split('-', $kernel );
|
||||
my $label = "ZFSBootMenu-$version";
|
||||
my $menu_label = "ZFS Boot Menu v$version";
|
||||
|
||||
|
@ -230,8 +220,8 @@ EOF
|
|||
|
||||
print CFG "LABEL $label\n";
|
||||
print CFG "MENU LABEL $menu_label\n";
|
||||
print CFG "KERNEL /$kernel\n";
|
||||
print CFG "INITRD /initramfs-$version.img\n";
|
||||
print CFG "KERNEL $directory/$kernel\n";
|
||||
print CFG "INITRD $directory/initramfs-$version.img\n";
|
||||
print CFG "APPEND $config{Kernel}{CommandLine}\n";
|
||||
print CFG "\n";
|
||||
|
||||
|
@ -241,6 +231,7 @@ EOF
|
|||
make_path dirname( $config{syslinux}{Config} );
|
||||
safeCopy( $runConf{syslinux_temp}, $config{syslinux}{Config} );
|
||||
}
|
||||
|
||||
# Finds the latest kernel in /boot
|
||||
sub latestKernel {
|
||||
my @prefixes = ( "vmlinux*", "vmlinuz*", "linux*", "kernel*" );
|
||||
|
|
|
@ -1,6 +1,8 @@
|
|||
[Global]
|
||||
ManageImages=0
|
||||
DracutConfDir=/etc/zfsbootmenu/dracut.conf.d
|
||||
BootMountPoint=/boot/efi
|
||||
FatFixes=1
|
||||
|
||||
[Kernel]
|
||||
CommandLine=ro quiet loglevel=0
|
||||
|
@ -16,6 +18,5 @@ Versioned=1
|
|||
Copies=0
|
||||
|
||||
[syslinux]
|
||||
ImageDir=/boot/syslinux
|
||||
Config=/boot/syslinux/syslinux.cfg
|
||||
Copies=0
|
||||
CreateConfig=0
|
||||
Config=/boot/efi/syslinux/syslinux.cfg
|
||||
|
|
Loading…
Reference in New Issue