Default to '0' if 'default' line not found at all in existing grub.conf

cleanup-cruft
Andrew Gaffney 16 years ago
parent a86ba695a9
commit 25fad8fd10

@ -2,6 +2,9 @@
# Copyright 1999-2008 Gentoo Foundation; 2008 Chris Gianelloni, Andrew Gaffney
# Distributed under the GPL v2
15 Dec 2008; Andrew Gaffney <agaffney@gentoo.org> gen_bootloader.sh:
Default to '0' if 'default' line not found at all in existing grub.conf
15 Dec 2008; Andrew Gaffney <agaffney@gentoo.org> gen_bootloader.sh:
Adding code that duplicates default grub.conf entry to replace old awk
script. Based on code written by Mike Auty <ikelos@gentoo.org>

@ -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

Loading…
Cancel
Save