forked from altcloud/mkimage-profiles
grub: Added the ability to define the default menu item
Example: @$(call set,GRUB_DEFAULT,uefi-firmware) @$(call xport,GRUB_DEFAULT) See features.in/grub/cfg.in/*.cfg
This commit is contained in:
parent
346e3c21a6
commit
1babd587ab
@ -40,6 +40,16 @@ fi
|
||||
# there should be DEFAULT directive there (at least for alterator-netinst)
|
||||
default_change() {
|
||||
local CFG=$1
|
||||
if [ -n "$GLOBAL_GRUB_DEFAULT" ]; then
|
||||
if [ -n "$(grep -i "$GLOBAL_GRUB_DEFAULT" "$CFG")" ]; then
|
||||
DEFAULT="$GLOBAL_GRUB_DEFAULT"
|
||||
sed -i '/^default/d'
|
||||
echo "default=$DEFAULT" >> "$CFG"
|
||||
else
|
||||
echo "error: $GLOBAL_GRUB_DEFAULT missing in $CFG" >&2
|
||||
exit 1
|
||||
fi
|
||||
fi
|
||||
if ! grep -i '^default' "$CFG"; then
|
||||
DEFAULT="$(grep -i '\-\-id ' "$CFG" | head -1 | rev| cut -f2 -d' ' |rev)"
|
||||
if [ -n "$DEFAULT" ]; then
|
||||
|
Loading…
Reference in New Issue
Block a user