summaryrefslogtreecommitdiffstats
path: root/debian/patches/mkconfig-ubuntu-recovery.patch
blob: 1fa5bdeca1c27c880e3c5abd13d2c17ff5966387 (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
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
From 13c9a7101d2611bbc02b464ef4e32b02cfc7860b Mon Sep 17 00:00:00 2001
From: Colin Watson <cjwatson@ubuntu.com>
Date: Mon, 13 Jan 2014 12:13:06 +0000
Subject: "single" -> "recovery" when friendly-recovery is installed
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit

If configured with --enable-ubuntu-recovery, also set nomodeset for
recovery mode, and disable 'set gfxpayload=keep' even if the system
normally supports it.  See
https://launchpad.net/ubuntu/+spec/desktop-o-xorg-tools-and-processes.

Author: Stéphane Graber <stgraber@ubuntu.com>
Forwarded: no
Last-Update: 2013-12-25

Patch-Name: mkconfig-ubuntu-recovery.patch
---
 configure.ac                | 11 +++++++++++
 util/grub.d/10_linux.in     | 16 ++++++++++++++--
 util/grub.d/30_os-prober.in |  2 +-
 3 files changed, 26 insertions(+), 3 deletions(-)

diff --git a/configure.ac b/configure.ac
index 7517fc49d..74778a6f8 100644
--- a/configure.ac
+++ b/configure.ac
@@ -1904,6 +1904,17 @@ fi
 AC_SUBST([LIBZFS])
 AC_SUBST([LIBNVPAIR])
 
+AC_ARG_ENABLE([ubuntu-recovery],
+              [AS_HELP_STRING([--enable-ubuntu-recovery],
+                              [adjust boot options for the Ubuntu recovery mode (default=no)])],
+              [], [enable_ubuntu_recovery=no])
+if test x"$enable_ubuntu_recovery" = xyes ; then
+  UBUNTU_RECOVERY=1
+else
+  UBUNTU_RECOVERY=0
+fi
+AC_SUBST([UBUNTU_RECOVERY])
+
 LIBS=""
 
 AC_SUBST([FONT_SOURCE])
diff --git a/util/grub.d/10_linux.in b/util/grub.d/10_linux.in
index 46696dd66..f215e3213 100644
--- a/util/grub.d/10_linux.in
+++ b/util/grub.d/10_linux.in
@@ -20,6 +20,7 @@ set -e
 prefix="@prefix@"
 exec_prefix="@exec_prefix@"
 datarootdir="@datarootdir@"
+ubuntu_recovery="@UBUNTU_RECOVERY@"
 
 . "$pkgdatadir/grub-mkconfig_lib"
 
@@ -84,6 +85,15 @@ esac
 
 title_correction_code=
 
+if [ -x /lib/recovery-mode/recovery-menu ]; then
+    GRUB_CMDLINE_LINUX_RECOVERY=recovery
+else
+    GRUB_CMDLINE_LINUX_RECOVERY=single
+fi
+if [ "$ubuntu_recovery" = 1 ]; then
+    GRUB_CMDLINE_LINUX_RECOVERY="$GRUB_CMDLINE_LINUX_RECOVERY nomodeset"
+fi
+
 linux_entry ()
 {
   os="$1"
@@ -123,7 +133,9 @@ linux_entry ()
       if [ "x$GRUB_GFXPAYLOAD_LINUX" != xtext ]; then
 	  echo "	load_video" | sed "s/^/$submenu_indentation/"
       fi
-      echo "	set gfxpayload=$GRUB_GFXPAYLOAD_LINUX" | sed "s/^/$submenu_indentation/"
+      if [ "$ubuntu_recovery" = 0 ] || [ x$type != xrecovery ]; then
+	  echo "	set gfxpayload=$GRUB_GFXPAYLOAD_LINUX" | sed "s/^/$submenu_indentation/"
+      fi
   fi
 
   echo "	insmod gzio" | sed "s/^/$submenu_indentation/"
@@ -288,7 +300,7 @@ while [ "x$list" != "x" ] ; do
               "${GRUB_CMDLINE_LINUX} ${GRUB_CMDLINE_LINUX_DEFAULT}"
   if [ "x${GRUB_DISABLE_RECOVERY}" != "xtrue" ]; then
     linux_entry "${OS}" "${version}" recovery \
-                "single ${GRUB_CMDLINE_LINUX}"
+                "${GRUB_CMDLINE_LINUX_RECOVERY} ${GRUB_CMDLINE_LINUX}"
   fi
 
   list=`echo $list | tr ' ' '\n' | fgrep -vx "$linux" | tr '\n' ' '`
diff --git a/util/grub.d/30_os-prober.in b/util/grub.d/30_os-prober.in
index 5984e92d2..37d5f05b5 100644
--- a/util/grub.d/30_os-prober.in
+++ b/util/grub.d/30_os-prober.in
@@ -223,7 +223,7 @@ EOF
 	fi
 
 	onstr="$(gettext_printf "(on %s)" "${DEVICE}")"
-	recovery_params="$(echo "${LPARAMS}" | grep single)" || true
+	recovery_params="$(echo "${LPARAMS}" | grep 'single\|recovery')" || true
 	counter=1
 	while echo "$used_osprober_linux_ids" | grep 'osprober-gnulinux-$LKERNEL-${recovery_params}-$counter-$boot_device_id' > /dev/null; do
 	    counter=$((counter+1));