syslinux: Added the ability to define the default menu item

Example:
@$(call set,SYSLINUX_DEFAULT,harddisk)
@$(call xport,SYSLINUX_DEFAULT)

See features.in/syslinux/cfg.in/*.cfg
This commit is contained in:
Anton Midyukov 2020-08-27 14:26:38 +07:00
parent a6c3620672
commit 346e3c21a6

View File

@ -34,6 +34,16 @@ fi
grep -hv '^#' .in/[0-9][0-9]*.cfg > "$CFG" grep -hv '^#' .in/[0-9][0-9]*.cfg > "$CFG"
# there should be DEFAULT directive there (at least for alterator-netinst) # there should be DEFAULT directive there (at least for alterator-netinst)
if [ -n "$GLOBAL_SYSLINUX_DEFAULT" ]; then
if [ -n "$(grep -i "^label $GLOBAL_SYSLINUX_DEFAULT" "$CFG")" ]; then
DEFAULT="$GLOBAL_SYSLINUX_DEFAULT"
sed -i '/^default/d'
echo "default $DEFAULT" >> "$CFG"
else
echo "error: $GLOBAL_SYSLINUX_DEFAULT missing in $CFG" >&2
exit 1
fi
fi
if ! grep -i '^default' "$CFG"; then if ! grep -i '^default' "$CFG"; then
DEFAULT="$(grep -i '^label ' "$CFG" | head -1 | cut -f2 -d' ')" DEFAULT="$(grep -i '^label ' "$CFG" | head -1 | cut -f2 -d' ')"
if [ -n "$DEFAULT" ]; then if [ -n "$DEFAULT" ]; then