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