From d19a4a20534418d990298ec198dcd973a5587736 Mon Sep 17 00:00:00 2001 From: Artem Bityutskiy Date: Fri, 8 Nov 2013 13:44:12 +0200 Subject: [PATCH] setup-gummitoot-conf: handle commented-out default entries The 'setup-gummiboot-conf' script does not handle commented-out default entreis ("# default"). The reason is that the corresponding regexp was incorrect, because it did not searh from the beginning of the line, because of missing "^" symbol. This patch fixes the problem. Change-Id: I0bc8cd92bba127fcbea3908046c3bc209fbf02d1 Signed-off-by: Artem Bityutskiy --- setup-gummiboot-conf | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/setup-gummiboot-conf b/setup-gummiboot-conf index 5a84ad9..19d0054 100755 --- a/setup-gummiboot-conf +++ b/setup-gummiboot-conf @@ -62,7 +62,7 @@ entries="$(ls -1 "$entries_dir" | sed -e 's/\.conf$//g' | sort -r)" fatal "no gummiboot entries found in \"$entries_dir\"" # Get the default entry name -default_entry="$(cat "$conf_file" | sed -n -e 's/[ \t]*default[ \t]\+\(.\+\)[ \t]*/\1.conf/p')" +default_entry="$(cat "$conf_file" | sed -n -e 's/^[ \t]*default[ \t]\+\(.\+\)[ \t]*/\1.conf/p')" [ -n "$default_entry" ] || \ fatal "cannot find the default entry in \"$conf_file\"" [ "$(printf "%s\n" "$default_entry" | wc -l)" -eq "1" ] || \ @@ -98,7 +98,7 @@ done # Update the default entry newest_kernel="$(printf "%s" "$kernels" | head -n1)" -sed -i -e "s/[ \t]*default[ \t]\+.*/default $newest_kernel/" "$conf_file" +sed -i -e "s/^[ \t]*default[ \t]\+.*/default $newest_kernel/" "$conf_file" # Remove gummiboot entries for non-existing kernels printf "%s\n" "$entries" | while IFS= read -r entry; do -- 2.7.4