From: Andrew Gaffney Date: Mon, 15 Dec 2008 13:42:32 +0000 (-0600) Subject: Default to '0' if 'default' line not found at all in existing grub.conf X-Git-Tag: v3.4.10.903~20 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=25fad8fd10fc2dfadbfec3bfe22eb22e8881efd1;p=genkernel.git Default to '0' if 'default' line not found at all in existing grub.conf --- 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