From aed27a30f8c2bf6065c30a4cdbb9ee0f711b0953 Mon Sep 17 00:00:00 2001 From: Evgeny Sinelnikov Date: Wed, 19 May 2021 15:52:34 +0400 Subject: [PATCH] grub: look for any way to set default menu item This prepares the ability to write and read the default menu item from the grubenv file. If grub.cfg contains a line like '^default=id', then the read value is not used. Setting the default menu item from the grubenv file will be indented inside the 'if' optator and therefore does not match the '^default' pattern. --- features.in/grub/stage1/scripts.d/01-grub | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/features.in/grub/stage1/scripts.d/01-grub b/features.in/grub/stage1/scripts.d/01-grub index f4a365bf..cdbc6574 100755 --- a/features.in/grub/stage1/scripts.d/01-grub +++ b/features.in/grub/stage1/scripts.d/01-grub @@ -36,7 +36,7 @@ if [ -n "$GLOBAL_GRUB_DEFAULT" ]; then exit 1 fi fi -if ! grep -i '^default' "$CFG"; then +if ! grep -i '^\s*\(set\s\+\)\?default=' "$CFG"; then DEFAULT="$(grep -i '\-\-id ' "$CFG" | head -1 | rev| cut -f2 -d' ' |rev)" if [ -n "$DEFAULT" ]; then echo "default=$DEFAULT" >> "$CFG"