Skip to content

Commit

Permalink
change get_chosen to find 'submenu>kenel'
Browse files Browse the repository at this point in the history
changes in grub.cfg to prevent unwanted kernel upgrades
  • Loading branch information
david committed Aug 22, 2017
1 parent f64f390 commit 73920fa
Showing 1 changed file with 17 additions and 6 deletions.
23 changes: 17 additions & 6 deletions mxgrub/mxgrub
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -187,15 +193,20 @@ 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" --id="$submenu>$MARIUX_DEFAULT" --unrestricted { save_env chosen="$submenu>$MARIUX_DEFAULT" ; 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" = "\$default" ]; then
set default="$submenu>\$chosen"
unset chosen
fi
if [ \$chosen ]; then
set default=\$chosen
unset chosen # must be clear to get a clean value from menuentry
fi
fi
EOF

Expand Down

0 comments on commit 73920fa

Please sign in to comment.