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>
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")"