From 25fad8fd10fc2dfadbfec3bfe22eb22e8881efd1 Mon Sep 17 00:00:00 2001 From: Andrew Gaffney Date: Mon, 15 Dec 2008 07:42:32 -0600 Subject: [PATCH] Default to '0' if 'default' line not found at all in existing grub.conf --- ChangeLog | 3 +++ gen_bootloader.sh | 4 ++++ 2 files changed, 7 insertions(+) diff --git a/ChangeLog b/ChangeLog index c580344..ddb6839 100644 --- a/ChangeLog +++ b/ChangeLog @@ -2,6 +2,9 @@ # Copyright 1999-2008 Gentoo Foundation; 2008 Chris Gianelloni, Andrew Gaffney # Distributed under the GPL v2 + 15 Dec 2008; Andrew Gaffney gen_bootloader.sh: + Default to '0' if 'default' line not found at all in existing grub.conf + 15 Dec 2008; Andrew Gaffney gen_bootloader.sh: Adding code that duplicates default grub.conf entry to replace old awk script. Based on code written by Mike Auty diff --git a/gen_bootloader.sh b/gen_bootloader.sh index 5f0bb51..4976e04 100644 --- a/gen_bootloader.sh +++ b/gen_bootloader.sh @@ -103,6 +103,10 @@ set_bootloader_grub_duplicate_default() { # Find default entry default=$(sed -rn '/^[[:space:]]*default[[:space:]=]/s/^.*default[[:space:]=]+([[:alnum:]]+).*$/\1/p' "${GRUB_CONF}") + if [ -z "${default}" ]; then + print_warning 1 "No default entry found...assuming 0" + default=0 + fi if ! echo ${default} | grep -q '^[0-9]\+$'; then print_error 1 "We don't support non-numeric (such as 'saved') default values...skipping update" return 0 -- 2.26.2