Skip to content

Commit

Permalink
fixed the missing seperator
Browse files Browse the repository at this point in the history
last problem if you use
`mxgrub default` -> grub-editenv - set chosen=mariux-4.9.43-170
`mxgrub mariux-4.9.43-170` -> grub-editenv - set chosen=all-other-kernel>mariux-4.9.43-170
  • Loading branch information
david committed Aug 21, 2017
1 parent c32650b commit f64f390
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions mxgrub/mxgrub
Original file line number Diff line number Diff line change
Expand Up @@ -86,11 +86,13 @@ sub is_VX50 {
return $data=~/VX50/;
}

our $submenu="all-other-kernel";

sub get_chosen {
my $chosen;
open my $p,'-|','grub-editenv','-','list' or die "$!\n";
while (<$p>) {
/^chosen=(.+)/ and return $1;
/^chosen=$submenu\>(.+)|^chosen=(.+)/ and return $1;
}
close $p or die "$!\n";
$? and exit 1;
Expand Down Expand Up @@ -185,9 +187,9 @@ if [ -e /etc/local/USB.usb ]; then
menuentry "mariuxUSB" --unrestricted { save_env chosen ; linux /boot/bzImage.x86_64 crashkernel=256M root=LABEL=rootusb ro ; initrd /boot/grub/initramfs.igz }
else
menuentry "$MARIUX_DEFAULT" --unrestricted { save_env chosen ; linux /boot/bzImage.x86_64 crashkernel=256M root=LABEL=root ro ; initrd /boot/grub/initramfs.igz }
menuentry "$MARIUX_DEFAULT" --unrestricted { save_env chosen ; linux /boot/bzImage.x86_64 crashkernel=256M root=LABEL=root ro console=ttyS1,115200n8 console=tty0 ; initrd /boot/grub/initramfs.igz }
submenu "all other kernel" --unrestricted {
submenu "$submenu" --unrestricted {
$kernellist
}
if [ \$chosen ]; then
Expand Down Expand Up @@ -245,7 +247,7 @@ sub cmd_install {
if ($label eq 'default') {
sys('grub-editenv','-','set',"chosen=$MARIUX_DEFAULT");
} else {
sys('grub-editenv','-','set',"chosen=$label");
sys('grub-editenv','-','set',"chosen=$submenu>$label");
}
}

Expand Down

1 comment on commit f64f390

@donald
Copy link
Collaborator

@donald donald commented on f64f390 Aug 21, 2017

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Havn't tested, but I don't think, this is enough. When the chosen image is something from the submenu, then the submenu will be open during the countdown and the chosen highlighted. If I abort the countdown, I'm still in the submenu, with no default visible. There might be a way to leave the submenu, but I don't know it.

Please sign in to comment.