diff --git a/mxgrub/mxgrub b/mxgrub/mxgrub index 34a5173..f43fb84 100755 --- a/mxgrub/mxgrub +++ b/mxgrub/mxgrub @@ -92,7 +92,13 @@ sub get_chosen { my $chosen; open my $p,'-|','grub-editenv','-','list' or die "$!\n"; while (<$p>) { - /^chosen=$submenu\>(.+)|^chosen=(.+)/ and return $1; + /^chosen=$submenu>(.+)/; + if (defined $1) { + return $1; + } else { + /^chosen=(.+)/ and return $1; + } + } close $p or die "$!\n"; $? and exit 1; @@ -187,15 +193,15 @@ 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 console=ttyS1,115200n8 console=tty0 ; initrd /boot/grub/initramfs.igz } +menuentry "$MARIUX_DEFAULT" --unrestricted { set chosen="$submenu>$MARIUX_DEFAULT" ; 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 "$submenu" --unrestricted { $kernellist } - if [ \$chosen ]; then - set default=\$chosen - unset chosen # must be clear to get a clean value from menuentry - fi + if [ \$chosen ]; then + set default=\$chosen + unset chosen # must be clear to get a clean value from menuentry + fi fi EOF