summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorArtem Bityutskiy <artem.bityutskiy@linux.intel.com>2013-06-26 12:58:06 +0300
committerArtem Bityutskiy <artem.bityutskiy@linux.intel.com>2013-06-26 12:58:06 +0300
commit00213d01da907d27d1b66d6c9481f1bd0b48582b (patch)
treef81074b181cd45fb9f2943be4a7759fc32cb18d4
parent8f55f86c05c03e6a1a7b6345760a86fbc56561d6 (diff)
downloadsetup-efi-ivi-00213d01da907d27d1b66d6c9481f1bd0b48582b.tar.gz
setup-efi-ivi-00213d01da907d27d1b66d6c9481f1bd0b48582b.tar.bz2
setup-efi-ivi-00213d01da907d27d1b66d6c9481f1bd0b48582b.zip
setup-gummiboot-conf: handle the case of absent default entry
When the kernel which corresponds to the current default entry is removed, the script fails. Fix this. Signed-off-by: Artem Bityutskiy <artem.bityutskiy@linux.intel.com>
-rwxr-xr-xsetup-gummiboot-conf8
1 files changed, 6 insertions, 2 deletions
diff --git a/setup-gummiboot-conf b/setup-gummiboot-conf
index 81dda83..4af3d56 100755
--- a/setup-gummiboot-conf
+++ b/setup-gummiboot-conf
@@ -56,8 +56,12 @@ default_entry="$(cat "$conf_file" | sed -n -e 's/[ \t]*default[ \t]\+\(.\+\)[ \t
fatal "cannot find the default entry in \"$conf_file\""
[ "$(printf "%s\n" "$default_entry" | wc -l)" -eq "1" ] || \
fatal "more than one default entry in \"$conf_file\""
-[ -f "$entries_dir/$default_entry" ] || \
- fatal "the default gummiboot entry file does not exist: \"$entries_dir/$default_entry\""
+
+if ! [ -f "$entries_dir/$default_entry" ]; then
+ # The default entry does not exist anymore. Pick the entry
+ # corresponding to the newest kernel then.
+ default_entry="$(printf "%s" "$entries" | head -n1)"
+fi
# Use the default entry to prepare the pattern for other entries
pattern="$(cat "$entries_dir/$default_entry")"