summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorArtem Bityutskiy <artem.bityutskiy@linux.intel.com>2013-11-07 14:54:34 +0200
committerArtem Bityutskiy <artem.bityutskiy@linux.intel.com>2013-11-07 15:25:19 +0200
commit11eb2c69d49e56e5d5fec2cf02e428419eebbadd (patch)
treee84a9773fa5349cc7d57c57c800294e8ff0312e2
parent15b7894de52f548e3a4c70f05437ea138839a6ea (diff)
downloadsetup-efi-ivi-11eb2c69d49e56e5d5fec2cf02e428419eebbadd.tar.gz
setup-efi-ivi-11eb2c69d49e56e5d5fec2cf02e428419eebbadd.tar.bz2
setup-efi-ivi-11eb2c69d49e56e5d5fec2cf02e428419eebbadd.zip
setup-gummiboot-conf: fix non-existing kernels handling
This patch is a bug-fix and it fixes the case when the default entry in 'loader.conf' does not actually exist in 'loader/entries'. Instead of failing, we should just find the newest existing version of the kernel. Change-Id: I61e169f37b5487b8abd6188a771f37f2f08ab328 Signed-off-by: Artem Bityutskiy <artem.bityutskiy@linux.intel.com>
-rwxr-xr-xsetup-gummiboot-conf12
1 files changed, 7 insertions, 5 deletions
diff --git a/setup-gummiboot-conf b/setup-gummiboot-conf
index fa0cf58..5a84ad9 100755
--- a/setup-gummiboot-conf
+++ b/setup-gummiboot-conf
@@ -68,11 +68,13 @@ default_entry="$(cat "$conf_file" | sed -n -e 's/[ \t]*default[ \t]\+\(.\+\)[ \t
[ "$(printf "%s\n" "$default_entry" | wc -l)" -eq "1" ] || \
fatal "more than one default entry in \"$conf_file\""
-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
+while ! [ -f "$entries_dir/$default_entry" ]; do
+ # The default entry does not exist anymore. Remove it and pick the
+ # entry corresponding to the newest installed kerne.
+ rm -f "$entries_dir/$default_entry"
+ entries="$(printf "%s" "$entries" | tail -n+2)"
+ default_entry="$(printf "%s" "$entries" | head -n1).conf"
+done
# Use the default entry to prepare the pattern for other entries
pattern="$(cat "$entries_dir/$default_entry")"