0003-10_linux-20_linux_xen-detect-parabola-initramfs.patch 5.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127
  1. diff -Nur a/util/grub.d/10_linux.in b/util/grub.d/10_linux.in
  2. --- a/util/grub.d/10_linux.in 2015-09-27 14:14:45.544730230 -0300
  3. +++ b/util/grub.d/10_linux.in 2015-09-27 15:34:19.822404966 -0300
  4. @@ -80,9 +80,11 @@
  5. if [ x$type != xsimple ] ; then
  6. case $type in
  7. recovery)
  8. - title="$(gettext_printf "%s, with Linux %s (recovery mode)" "${os}" "${version}")" ;;
  9. + title="$(gettext_printf "%s, %s kernel (recovery mode)" "${os}" "${version}")" ;;
  10. + fallback)
  11. + title="$(gettext_printf "%s, %s kernel (fallback initramfs)" "${os}" "${version}")" ;;
  12. *)
  13. - title="$(gettext_printf "%s, with Linux %s" "${os}" "${version}")" ;;
  14. + title="$(gettext_printf "%s, %s kernel" "${os}" "${version}")" ;;
  15. esac
  16. if [ x"$title" = x"$GRUB_ACTUAL_DEFAULT" ] || [ x"Previous Linux versions>$title" = x"$GRUB_ACTUAL_DEFAULT" ]; then
  17. replacement_title="$(echo "Advanced options for ${OS}" | sed 's,>,>>,g')>$(echo "$title" | sed 's,>,>>,g')"
  18. @@ -94,7 +96,7 @@
  19. else
  20. echo "menuentry '$(echo "$os" | grub_quote)' ${CLASS} \$menuentry_id_option 'gnulinux-simple-$boot_device_id' {" | sed "s/^/$submenu_indentation/"
  21. fi
  22. - if [ x$type != xrecovery ] ; then
  23. + if [ x$type != xrecovery ] && [ x$type != xfallback ] ; then
  24. save_default_entry | grub_add_tab
  25. fi
  26. @@ -126,7 +128,7 @@
  27. fi
  28. printf '%s\n' "${prepare_boot_cache}" | sed "s/^/$submenu_indentation/"
  29. fi
  30. - message="$(gettext_printf "Loading Linux %s ..." ${version})"
  31. + message="$(gettext_printf "Loading %s kernel ..." ${version})"
  32. sed "s/^/$submenu_indentation/" << EOF
  33. echo '$(echo "$message" | grub_quote)'
  34. linux ${rel_dirname}/${basename} root=${linux_root_device_thisversion} ro ${args}
  35. @@ -182,7 +184,7 @@
  36. basename=`basename $linux`
  37. dirname=`dirname $linux`
  38. rel_dirname=`make_system_path_relative_to_its_root $dirname`
  39. - version=`echo $basename | sed -e "s,^[^0-9]*-,,g"`
  40. + version=`echo $basename | sed -e "s,vmlinuz-,,g"`
  41. alt_version=`echo $version | sed -e "s,\.old$,,g"`
  42. linux_root_device_thisversion="${LINUX_ROOT_DEVICE}"
  43. @@ -238,6 +240,18 @@
  44. linux_entry "${OS}" "${version}" advanced \
  45. "${GRUB_CMDLINE_LINUX} ${GRUB_CMDLINE_LINUX_DEFAULT}"
  46. +
  47. + if test -e "${dirname}/initramfs-${version}-fallback.img" ; then
  48. + initrd="initramfs-${version}-fallback.img"
  49. +
  50. + if test -n "${initrd}" ; then
  51. + gettext_printf "Found fallback initramfs image: %s\n" "${dirname}/${initrd}" >&2
  52. + fi
  53. +
  54. + linux_entry "${OS}" "${version}" fallback \
  55. + "${GRUB_CMDLINE_LINUX} ${GRUB_CMDLINE_LINUX_DEFAULT}"
  56. + fi
  57. +
  58. if [ "x${GRUB_DISABLE_RECOVERY}" != "xtrue" ]; then
  59. linux_entry "${OS}" "${version}" recovery \
  60. "single ${GRUB_CMDLINE_LINUX}"
  61. diff -Nur a/util/grub.d/20_linux_xen.in b/util/grub.d/20_linux_xen.in
  62. --- a/util/grub.d/20_linux_xen.in 2015-09-27 14:14:45.544730230 -0300
  63. +++ b/util/grub.d/20_linux_xen.in 2015-09-27 15:35:00.589739244 -0300
  64. @@ -88,9 +88,11 @@
  65. fi
  66. if [ x$type != xsimple ] ; then
  67. if [ x$type = xrecovery ] ; then
  68. - title="$(gettext_printf "%s, with Xen %s and Linux %s (recovery mode)" "${os}" "${xen_version}" "${version}")"
  69. + title="$(gettext_printf "%s, with Xen %s and %s kernel (recovery mode)" "${os}" "${xen_version}" "${version}")"
  70. + elif [ x$type = xfallback ] ; then
  71. + title="$(gettext_printf "%s, with Xen %s and %s kernel (fallback initramfs)" "${os}" "${xen_version}" "${version}")"
  72. else
  73. - title="$(gettext_printf "%s, with Xen %s and Linux %s" "${os}" "${xen_version}" "${version}")"
  74. + title="$(gettext_printf "%s, with Xen %s and %s kernel" "${os}" "${xen_version}" "${version}")"
  75. fi
  76. replacement_title="$(echo "Advanced options for ${OS}" | sed 's,>,>>,g')>$(echo "$title" | sed 's,>,>>,g')"
  77. if [ x"Xen ${xen_version}>$title" = x"$GRUB_ACTUAL_DEFAULT" ]; then
  78. @@ -103,7 +105,7 @@
  79. title="$(gettext_printf "%s, with Xen hypervisor" "${os}")"
  80. echo "menuentry '$(echo "$title" | grub_quote)' ${CLASS} \$menuentry_id_option 'xen-gnulinux-simple-$boot_device_id' {" | sed "s/^/$submenu_indentation/"
  81. fi
  82. - if [ x$type != xrecovery ] ; then
  83. + if [ x$type != xrecovery ] && [ x$type != xfallback ] ; then
  84. save_default_entry | grub_add_tab | sed "s/^/$submenu_indentation/"
  85. fi
  86. @@ -112,7 +114,7 @@
  87. fi
  88. printf '%s\n' "${prepare_boot_cache}" | sed "s/^/$submenu_indentation/"
  89. xmessage="$(gettext_printf "Loading Xen %s ..." ${xen_version})"
  90. - lmessage="$(gettext_printf "Loading Linux %s ..." ${version})"
  91. + lmessage="$(gettext_printf "Loading %s kernel ..." ${version})"
  92. sed "s/^/$submenu_indentation/" << EOF
  93. echo '$(echo "$xmessage" | grub_quote)'
  94. if [ "\$grub_platform" = "pc" -o "\$grub_platform" = "" ]; then
  95. @@ -210,7 +212,7 @@
  96. basename=`basename $linux`
  97. dirname=`dirname $linux`
  98. rel_dirname=`make_system_path_relative_to_its_root $dirname`
  99. - version=`echo $basename | sed -e "s,^[^0-9]*-,,g"`
  100. + version=`echo $basename | sed -e "s,vmlinuz-,,g"`
  101. alt_version=`echo $version | sed -e "s,\.old$,,g"`
  102. linux_root_device_thisversion="${LINUX_ROOT_DEVICE}"
  103. @@ -252,6 +254,18 @@
  104. linux_entry "${OS}" "${version}" "${xen_version}" advanced \
  105. "${GRUB_CMDLINE_LINUX} ${GRUB_CMDLINE_LINUX_DEFAULT}" "${GRUB_CMDLINE_XEN} ${GRUB_CMDLINE_XEN_DEFAULT}"
  106. +
  107. + if test -e "${dirname}/initramfs-${version}-fallback.img" ; then
  108. + initrd="initramfs-${version}-fallback.img"
  109. +
  110. + if test -n "${initrd}" ; then
  111. + gettext_printf "Found fallback initramfs image: %s\n" "${dirname}/${initrd}" >&2
  112. + fi
  113. +
  114. + linux_entry "${OS}" "${version}" "${xen_version}" fallback \
  115. + "${GRUB_CMDLINE_LINUX} ${GRUB_CMDLINE_LINUX_DEFAULT}" "${GRUB_CMDLINE_XEN} ${GRUB_CMDLINE_XEN_DEFAULT}"
  116. + fi
  117. +
  118. if [ "x${GRUB_DISABLE_RECOVERY}" != "xtrue" ]; then
  119. linux_entry "${OS}" "${version}" "${xen_version}" recovery \
  120. "single ${GRUB_CMDLINE_LINUX}" "${GRUB_CMDLINE_XEN}"