diff --git a/bin/generate-zbm b/bin/generate-zbm index 5dc84b8..9300ba6 100755 --- a/bin/generate-zbm +++ b/bin/generate-zbm @@ -3,7 +3,7 @@ use strict; use warnings; -our $VERSION = '0.8.0'; +our $VERSION = '0.8.1'; use Getopt::Long qw(:config no_ignore_case auto_version); use Pod::Usage qw(pod2usage); @@ -29,13 +29,13 @@ sub safeCopy; sub cleanupMount; BEGIN { - $SIG{INT} = \&cleanupMount; - $SIG{TERM} = \&cleanupMount; + $SIG{INT} = \&cleanupMount; + $SIG{TERM} = \&cleanupMount; } my ( %runConf, %config, %components ); -my $configfile = "/etc/zfsbootmenu/config.ini"; +my $configfile = "/etc/zfsbootmenu/config.ini"; $runConf{bootdir} = "/boot"; $runConf{confd} = "/usr/share/zfsbootmenu/dracut.conf.d"; @@ -79,7 +79,7 @@ $runConf{umount_on_exit} = 0; if ( ( defined $config{Global}{BootMountPoint} ) and ( length $config{Global}{BootMountPoint} ) ) { my $mounted = 0; - my $cmd = "mount"; + my $cmd = "mount"; my @output = execute($cmd); my $status = pop(@output); foreach my $line (@output) { @@ -211,7 +211,7 @@ if ( defined( $config{Components}{Copies} ) and ( $config{Components}{Copies} gt } # Generate syslinux.cfg, requires components to be built -if ( defined( $config{syslinux}{CreateConfig} ) and ( $config{syslinux}{CreateConfig} eq 1 ) ) { +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); @@ -224,8 +224,8 @@ if ( defined( $config{syslinux}{CreateConfig} ) and ( $config{syslinux}{CreateCo push( @components, $entry ); } - $runConf{syslinux_temp} = join('/', $tempdir, 'syslinux.conf'); - open CFG, '>', $runConf{syslinux_temp}; + $runConf{syslinux_temp} = join( '/', $tempdir, 'syslinux.conf' ); + open CFG, '>', $runConf{syslinux_temp}; my $header = <<'EOF'; UI menu.c32 @@ -241,13 +241,14 @@ EOF while (@components) { my $entry = pop(@components); - my $directory = dirname( $entry ); + my $directory = dirname($entry); + # Strip the mountpoint prefix out to generate a correct path based on / $directory =~ s/\Q$config{Global}{BootMountPoint}//; - my $kernel = basename( $entry ); - my (undef,$version) = split('-', $kernel ); - my $label = "ZFSBootMenu-$version"; + my $kernel = basename($entry); + my ( undef, $version ) = split( '-', $kernel ); + my $label = "ZFSBootMenu-$version"; my $menu_label = "ZFS Boot Menu v$version"; if ($add_default) { @@ -280,7 +281,7 @@ sub latestKernel { my $glob = join( '/', ( $runConf{bootdir}, $prefix ) ); my @kernels = glob($glob); next if !@kernels; - for (sort { versioncmp($b, $a) } @kernels ) { + for ( sort { versioncmp( $b, $a ) } @kernels ) { return $_; } } @@ -292,8 +293,8 @@ sub createInitramfs { my $output_file = join( '/', $temp, "zfsbootmenu" ); my @cmd = ( qw(dracut -q -f --confdir), $runConf{confd}, $output_file, qw(--kver), $kver, ); - my @output = execute(@cmd); - my $status = pop(@output); + my @output = execute(@cmd); + my $status = pop(@output); if ( $status eq 0 ) { return $output_file; } else { diff --git a/etc/zfsbootmenu/config.ini b/etc/zfsbootmenu/config.ini index 03a0c63..d251090 100644 --- a/etc/zfsbootmenu/config.ini +++ b/etc/zfsbootmenu/config.ini @@ -18,4 +18,4 @@ Copies=0 [syslinux] CreateConfig=0 -Config=/boot/efi/syslinux/syslinux.cfg +Config=/boot/syslinux/syslinux.cfg