summarylogtreecommitdiffstats
path: root/20_linux_xen-detect-archlinux-initramfs.patch
blob: 93c0f54adf1fa9a89a9cf1c584000792fbd6c0c1 (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
30
31
32
33
34
35
36
37
38
39
40
41
diff --git a/util/grub.d/20_linux_xen.in b/util/grub.d/20_linux_xen.in
index 3b1f47049..7f1c8526a 100644
--- a/util/grub.d/20_linux_xen.in
+++ b/util/grub.d/20_linux_xen.in
@@ -118,6 +118,8 @@ linux_entry_xsm ()
   if [ x$type != xsimple ] ; then
       if [ x$type = xrecovery ] ; then
 	  title="$(gettext_printf "%s, with Xen %s and Linux %s (recovery mode)" "${os}" "${xen_version}" "${version}")"
+      elif [ x$type = xfallback ] ; then
+	  title="$(gettext_printf "%s, with Xen %s and Linux %s (fallback initramfs)" "${os}" "${xen_version}" "${version}")"
       else
 	  title="$(gettext_printf "%s, with Xen %s and Linux %s" "${os}" "${xen_version}" "${version}")"
       fi
@@ -275,7 +277,7 @@ while [ "x${xen_list}" != "x" ] ; do
 	basename=`basename $linux`
 	dirname=`dirname $linux`
 	rel_dirname=`make_system_path_relative_to_its_root $dirname`
-	version=`echo $basename | sed -e "s,^[^0-9]*-,,g"`
+	version=`echo $basename | sed -e "s,vmlinuz-,,g"`
 	alt_version=`echo $version | sed -e "s,\.old$,,g"`
 	linux_root_device_thisversion="${LINUX_ROOT_DEVICE}"
 
@@ -341,6 +343,18 @@ while [ "x${xen_list}" != "x" ] ; do
 
 	linux_entry "${OS}" "${version}" "${xen_version}" advanced \
 	    "${GRUB_CMDLINE_LINUX} ${GRUB_CMDLINE_LINUX_DEFAULT}" "${GRUB_CMDLINE_XEN} ${GRUB_CMDLINE_XEN_DEFAULT}"
+
+        if test -e "${dirname}/initramfs-${version}-fallback.img" ; then
+          initrd_real="initramfs-${version}-fallback.img"
+
+          if test -n "${initrd_real}" ; then
+            gettext_printf "Found fallback initrd image(s) in %s:%s\n" "${dirname}" "${initrd_extra} ${initrd_real}" >&2
+          fi
+
+          linux_entry "${OS}" "${version}" "${xen_version}" fallback \
+                      "${GRUB_CMDLINE_LINUX} ${GRUB_CMDLINE_LINUX_DEFAULT}" "${GRUB_CMDLINE_XEN} ${GRUB_CMDLINE_XEN_DEFAULT}"
+        fi
+
 	if [ "x${GRUB_DISABLE_RECOVERY}" != "xtrue" ]; then
 	    linux_entry "${OS}" "${version}" "${xen_version}" recovery \
 		"single ${GRUB_CMDLINE_LINUX}" "${GRUB_CMDLINE_XEN}"