]> git.proxmox.com Git - grub2.git/commitdiff
Generate alternative init entries in advanced menu
authorColin Watson <cjwatson@debian.org>
Sat, 3 Jan 2015 12:04:59 +0000 (12:04 +0000)
committerColin Watson <cjwatson@debian.org>
Tue, 27 Jan 2015 20:32:54 +0000 (20:32 +0000)
Add fallback boot entries for alternative installed init systems.  Based
on patches from Michael Biebl and Didier Roche.

Bug-Debian: https://bugs.debian.org/757298
Bug-Debian: https://bugs.debian.org/773173
Forwarded: no
Last-Update: 2015-01-03

Patch-Name: mkconfig_other_inits.patch

util/grub.d/10_linux.in
util/grub.d/20_linux_xen.in

index 86e35f21bdcef7bfe53e46ece8713e79f8aeb593..f201e7d07aa772b657dffb5285dbf48b9d4ae809 100644 (file)
@@ -32,6 +32,7 @@ export TEXTDOMAIN=@PACKAGE@
 export TEXTDOMAINDIR="@localedir@"
 
 CLASS="--class gnu-linux --class gnu --class os"
+SUPPORTED_INITS="sysvinit:/lib/sysvinit/init systemd:/lib/systemd/systemd upstart:/sbin/upstart"
 
 if [ "x${GRUB_DISTRIBUTOR}" = "x" ] ; then
   OS=GNU/Linux
@@ -115,6 +116,8 @@ linux_entry ()
       case $type in
          recovery)
              title="$(gettext_printf "%s, with Linux %s (%s)" "${os}" "${version}" "$(gettext "${GRUB_RECOVERY_TITLE}")")" ;;
+         init-*)
+             title="$(gettext_printf "%s, with Linux %s (%s)" "${os}" "${version}" "${type#init-}")" ;;
          *)
              title="$(gettext_printf "%s, with Linux %s" "${os}" "${version}")" ;;
       esac
@@ -340,6 +343,13 @@ while [ "x$list" != "x" ] ; do
 
   linux_entry "${OS}" "${version}" advanced \
               "${GRUB_CMDLINE_LINUX} ${GRUB_CMDLINE_LINUX_DEFAULT}"
+  for supported_init in ${SUPPORTED_INITS}; do
+    init_path="${supported_init#*:}"
+    if [ -x "${init_path}" ] && [ "$(readlink -f /sbin/init)" != "${init_path}" ]; then
+      linux_entry "${OS}" "${version}" "init-${supported_init%%:*}" \
+                 "${GRUB_CMDLINE_LINUX} ${GRUB_CMDLINE_LINUX_DEFAULT} init=${init_path}"
+    fi
+  done
   if [ "x${GRUB_DISABLE_RECOVERY}" != "xtrue" ]; then
     linux_entry "${OS}" "${version}" recovery \
                 "${GRUB_CMDLINE_LINUX_RECOVERY} ${GRUB_CMDLINE_LINUX}"
index a5e5e5092b5c16b2b0203d3034b1af00ae411c86..11b7e010562cefa8ff7218cb0c433f7aa92bb657 100644 (file)
@@ -27,6 +27,7 @@ export TEXTDOMAIN=@PACKAGE@
 export TEXTDOMAINDIR="@localedir@"
 
 CLASS="--class gnu-linux --class gnu --class os --class xen"
+SUPPORTED_INITS="sysvinit:/lib/sysvinit/init systemd:/lib/systemd/systemd upstart:/sbin/upstart"
 
 if [ "x${GRUB_DISTRIBUTOR}" = "x" ] ; then
   OS=GNU/Linux
@@ -94,6 +95,8 @@ linux_entry ()
   if [ x$type != xsimple ] ; then
       if [ x$type = xrecovery ] ; then
          title="$(gettext_printf "%s, with Xen %s and Linux %s (%s)" "${os}" "${xen_version}" "${version}" "$(gettext "${GRUB_RECOVERY_TITLE}")")"
+      elif [ "${type#init-}" != "$type" ] ; then
+         title="$(gettext_printf "%s, with Xen %s and Linux %s (%s)" "${os}" "${xen_version}" "${version}" "${type#init-}")"
       else
          title="$(gettext_printf "%s, with Xen %s and Linux %s" "${os}" "${xen_version}" "${version}")"
       fi
@@ -255,6 +258,14 @@ 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}"
+       for supported_init in ${SUPPORTED_INITS}; do
+           init_path="${supported_init#*:}"
+           if [ -x "${init_path}" ] && [ "$(readlink -f /sbin/init)" != "${init_path}" ]; then
+               linux_entry "${OS}" "${version}" "${xen_version}" "init-${supported_init%%:*}" \
+                   "${GRUB_CMDLINE_LINUX} ${GRUB_CMDLINE_LINUX_DEFAULT} init=${init_path}" "${GRUB_CMDLINE_XEN} ${GRUB_CMDLINE_XEN_DEFAULT}"
+
+           fi
+       done
        if [ "x${GRUB_DISABLE_RECOVERY}" != "xtrue" ]; then
            linux_entry "${OS}" "${version}" "${xen_version}" recovery \
                "single ${GRUB_CMDLINE_LINUX}" "${GRUB_CMDLINE_XEN}"