Commit aed27a30 authored by Evgeny Sinelnikov's avatar Evgeny Sinelnikov Committed by Dmitriy Terekhin

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.
parent 8354c1bb
......@@ -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"
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment