summarylogtreecommitdiffstats
path: root/grub-linux-default-hook.patch
blob: 2e7d7716c80a5ec3bd9d63c2346c2d25066acce6 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
--- /etc/grub.d/10_linux
+++ /etc/grub.d/10_linux
@@ -206,6 +206,26 @@
 
 reverse_sorted_list=$(echo $list | tr ' ' '\n' | sed -e 's/\.old$/ 1/; / 1$/! s/$/ 2/' | version_sort -r | sed -e 's/ 1$/.old/; s/ 2$//')
 
+default_kernel_present=false
+default_kernel_name="/boot/vmlinuz-linux"
+for linux in ${reverse_sorted_list}; do
+  if [ "x$linux" = "x$default_kernel_name" ]; then
+    default_kernel_present=true
+  fi
+done
+
+if [ "x$default_kernel_present" = xtrue ]; then
+  reverse_sorted_list=$(
+    echo "$default_kernel_name"
+    for linux in ${reverse_sorted_list}; do
+      if [ "x$linux" = "x$default_kernel_name" ];
+	then continue;
+      fi
+      echo "$linux"
+    done
+  )
+fi
+
 is_top_level=true
 for linux in ${reverse_sorted_list}; do
   gettext_printf "Found linux image: %s\n" "$linux" >&2