]> TLD Linux GIT Repositories - packages/grub2.git/blob - grub-mkconfig-diagnostics.patch
- merged 2.12 from PLD
[packages/grub2.git] / grub-mkconfig-diagnostics.patch
1 diff -ur grub-2.04.orig/util/grub.d/00_header.in grub-2.04/util/grub.d/00_header.in
2 --- grub-2.04.orig/util/grub.d/00_header.in     2019-08-18 15:45:01.994000000 +0200
3 +++ grub-2.04/util/grub.d/00_header.in  2019-08-18 15:45:18.507000000 +0200
4 @@ -229,7 +229,7 @@
5  if [ "x$gfxterm" = x1 ]; then
6      if [ "x$GRUB_THEME" != x ] && [ -f "$GRUB_THEME" ] \
7         && is_path_readable_by_grub "$GRUB_THEME"; then
8 -       gettext_printf "Found theme: %s\n" "$GRUB_THEME" >&2
9 +       gettext_printf "Found theme: %s\n" "$GRUB_THEME" >&3
10  
11         prepare_grub_to_access_device `${grub_probe} --target=device "$GRUB_THEME"`
12         cat << EOF
13 @@ -265,12 +265,12 @@
14  EOF
15      elif [ "x$GRUB_BACKGROUND" != x ] && [ -f "$GRUB_BACKGROUND" ] \
16             && is_path_readable_by_grub "$GRUB_BACKGROUND"; then
17 -       gettext_printf "Found background: %s\n" "$GRUB_BACKGROUND" >&2
18 +       gettext_printf "Found background: %s\n" "$GRUB_BACKGROUND" >&3
19         case "$GRUB_BACKGROUND" in 
20             *.png)         reader=png ;;
21             *.tga)         reader=tga ;;
22             *.jpg|*.jpeg)  reader=jpeg ;;
23 -           *)             gettext "Unsupported image format" >&2; echo >&2; exit 1 ;;
24 +           *)             gettext "Unsupported image format" >&3; echo >&3; exit 1 ;;
25         esac
26         prepare_grub_to_access_device `${grub_probe} --target=device "$GRUB_BACKGROUND"`
27         cat << EOF
28 diff -ur grub-2.04.orig/util/grub.d/10_hurd.in grub-2.04/util/grub.d/10_hurd.in
29 --- grub-2.04.orig/util/grub.d/10_hurd.in       2019-08-18 15:45:01.994000000 +0200
30 +++ grub-2.04/util/grub.d/10_hurd.in    2019-08-18 15:45:18.508000000 +0200
31 @@ -45,8 +45,8 @@
32      basename=`basename $i`
33      dirname=`dirname $i`
34      rel_dirname=`make_system_path_relative_to_its_root $dirname`
35 -    gettext_printf "Found GNU Mach: %s" "$i" >&2
36 -    echo >&2
37 +    gettext_printf "Found GNU Mach: %s" "$i" >&3
38 +    echo >&3
39      kernels="${kernels} ${rel_dirname}/${basename}"
40      at_least_one=true
41    fi
42 @@ -60,8 +60,8 @@
43  
44  for i in /hurd/${hurd_fs}.static /hurd/exec ; do
45    if test -e "$i" ; then
46 -    gettext_printf "Found Hurd module: %s" "$i" >&2
47 -    echo >&2
48 +    gettext_printf "Found Hurd module: %s" "$i" >&3
49 +    echo >&3
50      at_least_one=true
51    else
52      all_of_them=false
53 @@ -74,8 +74,8 @@
54  fi
55  
56  if ${all_of_them} && test -e /lib/ld.so.1 ; then : ; else
57 -  gettext "Some Hurd stuff found, but not enough to boot." >&2
58 -  echo >&2
59 +  gettext "Some Hurd stuff found, but not enough to boot." >&3
60 +  echo >&3
61    exit 1
62  fi
63  
64 diff -ur grub-2.04.orig/util/grub.d/10_kfreebsd.in grub-2.04/util/grub.d/10_kfreebsd.in
65 --- grub-2.04.orig/util/grub.d/10_kfreebsd.in   2019-08-18 15:45:01.994000000 +0200
66 +++ grub-2.04/util/grub.d/10_kfreebsd.in        2019-08-18 15:45:18.508000000 +0200
67 @@ -161,7 +161,7 @@
68  
69  while [ "x$list" != "x" ] ; do
70    kfreebsd=`version_find_latest $list`
71 -  gettext_printf "Found kernel of FreeBSD: %s\n" "$kfreebsd" >&2
72 +  gettext_printf "Found kernel of FreeBSD: %s\n" "$kfreebsd" >&3
73    basename=`basename $kfreebsd`
74    dirname=`dirname $kfreebsd`
75    rel_dirname=`make_system_path_relative_to_its_root $dirname`
76 @@ -210,7 +210,7 @@
77      fi
78    done
79    if test -n "${module_dir}" ; then
80 -    gettext_printf "Found kernel module directory: %s\n" "${module_dir}" >&2
81 +    gettext_printf "Found kernel module directory: %s\n" "${module_dir}" >&3
82      module_dir_rel=$(make_system_path_relative_to_its_root $module_dir)
83    fi
84  
85 diff -ur grub-2.04.orig/util/grub.d/10_linux.in grub-2.04/util/grub.d/10_linux.in
86 --- grub-2.04.orig/util/grub.d/10_linux.in      2019-08-18 15:45:01.994000000 +0200
87 +++ grub-2.04/util/grub.d/10_linux.in   2019-08-18 15:46:11.888000000 +0200
88 @@ -194,7 +194,7 @@
89  is_top_level=true
90  while [ "x$list" != "x" ] ; do
91    linux=`version_find_latest $list`
92 -  gettext_printf "Found linux image: %s\n" "$linux" >&2
93 +  gettext_printf "Found linux image: %s\n" "$linux" >&3
94    basename=`basename $linux`
95    dirname=`dirname $linux`
96    rel_dirname=`make_system_path_relative_to_its_root $dirname`
97 @@ -233,7 +233,7 @@
98      for i in ${initrd}; do
99        initrd_display="${initrd_display} ${dirname}/${i}"
100      done
101 -    gettext_printf "Found initrd image: %s\n" "$(echo $initrd_display)" >&2
102 +    gettext_printf "Found initrd image: %s\n" "$(echo $initrd_display)" >&3
103    fi
104  
105    config=
106 diff -ur grub-2.04.orig/util/grub.d/10_netbsd.in grub-2.04/util/grub.d/10_netbsd.in
107 --- grub-2.04.orig/util/grub.d/10_netbsd.in     2019-08-18 15:45:01.994000000 +0200
108 +++ grub-2.04/util/grub.d/10_netbsd.in  2019-08-18 15:45:18.508000000 +0200
109 @@ -155,7 +155,7 @@
110      continue
111    fi
112  
113 -  gettext_printf "Found NetBSD kernel: %s\n" "$k" >&2
114 +  gettext_printf "Found NetBSD kernel: %s\n" "$k" >&3
115  
116    if [ "x$is_top_level" = xtrue ] && [ "x${GRUB_DISABLE_SUBMENU}" != xy ]; then
117        netbsd_entry "knetbsd"   "$k" simple "${GRUB_CMDLINE_NETBSD_DEFAULT}"
118 diff -ur grub-2.04.orig/util/grub.d/10_windows.in grub-2.04/util/grub.d/10_windows.in
119 --- grub-2.04.orig/util/grub.d/10_windows.in    2019-08-18 15:45:01.994000000 +0200
120 +++ grub-2.04/util/grub.d/10_windows.in 2019-08-18 15:45:18.508000000 +0200
121 @@ -82,7 +82,7 @@
122    # Get boot device.
123    dev=`${grub_probe} -t device "$dir" 2>/dev/null` || continue
124  
125 -  gettext_printf "Found %s on %s (%s)\n" "$OS" "$drv" "$dev" >&2
126 +  gettext_printf "Found %s on %s (%s)\n" "$OS" "$drv" "$dev" >&3
127    cat << EOF
128  menuentry '$(echo "$OS" | grub_quote)' \$menuentry_id_option '$osid-$(grub_get_device_id "${dev}")' {
129  EOF
130 diff -ur grub-2.04.orig/util/grub.d/20_linux_xen.in grub-2.04/util/grub.d/20_linux_xen.in
131 --- grub-2.04.orig/util/grub.d/20_linux_xen.in  2019-08-18 15:45:01.994000000 +0200
132 +++ grub-2.04/util/grub.d/20_linux_xen.in       2019-08-18 15:46:22.468000000 +0200
133 @@ -243,7 +243,7 @@
134  
135      while [ "x$list" != "x" ] ; do
136         linux=`version_find_latest $list`
137 -       gettext_printf "Found linux image: %s\n" "$linux" >&2
138 +       gettext_printf "Found linux image: %s\n" "$linux" >&3
139         basename=`basename $linux`
140         dirname=`dirname $linux`
141         rel_dirname=`make_system_path_relative_to_its_root $dirname`
142 @@ -274,7 +274,7 @@
143             for i in ${initrd}; do
144                 initrd_display="${initrd_display} ${dirname}/${i}"
145             done
146 -           gettext_printf "Found initrd image: %s\n" "$(echo $initrd_display)" >&2
147 +           gettext_printf "Found initrd image: %s\n" "$(echo $initrd_display)" >&3
148         fi
149  
150         if test -z "${initrd_real}"; then
151 diff -ur grub-2.04.orig/util/grub.d/30_os-prober.in grub-2.04/util/grub.d/30_os-prober.in
152 --- grub-2.04.orig/util/grub.d/30_os-prober.in  2019-08-18 15:45:01.994000000 +0200
153 +++ grub-2.04/util/grub.d/30_os-prober.in       2019-08-18 15:47:18.536000000 +0200
154 @@ -123,7 +123,7 @@
155      fi
156  
157      if [ "x${GRUB_OS_PROBER_SKIP_LIST}" != "x" ] && [ "x`echo ${GRUB_OS_PROBER_SKIP_LIST} | grep -i -e '\b'${EXPUUID}'\b'`" != "x" ] ; then
158 -      echo "Skipped ${LONGNAME} on ${DEVICE} by user request." >&2
159 +      echo "Skipped ${LONGNAME} on ${DEVICE} by user request." >&3
160        continue
161      fi
162    fi
163 @@ -141,7 +141,7 @@
164    # os-prober returns text string followed by optional counter
165    CLASS="--class $(echo "${LABEL}" | LC_ALL=C sed 's,[[:digit:]]*$,,' | cut -d' ' -f1 | tr 'A-Z' 'a-z' | LC_ALL=C sed 's,[^[:alnum:]_],_,g')"
166  
167 -  gettext_printf "Found %s on %s\n" "${LONGNAME}" "${DEVICE}" >&2
168 +  gettext_printf "Found %s on %s\n" "${LONGNAME}" "${DEVICE}" >&3
169  
170    case ${BOOT} in
171      chain)
172 @@ -329,7 +329,7 @@
173      ;;
174      *)
175        # TRANSLATORS: %s is replaced by OS name.
176 -      gettext_printf "%s is not yet supported by grub-mkconfig.\n" "  ${LONGNAME}" >&2
177 +      gettext_printf "%s is not yet supported by grub-mkconfig.\n" "  ${LONGNAME}" >&3
178      ;;
179    esac
180  done
181 diff -ur grub-2.04.orig/util/grub-mkconfig.in grub-2.04/util/grub-mkconfig.in
182 --- grub-2.04.orig/util/grub-mkconfig.in        2019-08-18 15:45:01.994000000 +0200
183 +++ grub-2.04/util/grub-mkconfig.in     2019-08-18 15:45:18.509000000 +0200
184 @@ -258,11 +258,16 @@
185  if test "x${grub_cfg}" != "x"; then
186    rm -f "${grub_cfg}.new"
187    oldumask=$(umask); umask 077
188 +  # open fd &3 for diagnostic messages
189 +  exec 3>&1
190    exec > "${grub_cfg}.new"
191    umask $oldumask
192 +else
193 +  # open fd &3 for diagnostic messages
194 +  exec 3>&2
195  fi
196 -gettext "Generating grub configuration file ..." >&2
197 -echo >&2
198 +gettext "Generating grub configuration file ..." >&3
199 +echo >&3
200  
201  cat << EOF
202  #
203 @@ -297,8 +302,8 @@
204      gettext_printf "Syntax errors are detected in generated GRUB config file.
205  Ensure that there are no errors in /etc/sysconfig/grub
206  and /etc/grub.d/* files or please file a bug report with
207 -%s file attached." "${grub_cfg}.new" >&2
208 -    echo >&2
209 +%s file attached." "${grub_cfg}.new" >&3
210 +    echo >&3
211      exit 1
212    else
213      # none of the children aborted with error, install the new grub.cfg
214 @@ -306,5 +311,8 @@
215    fi
216  fi
217  
218 -gettext "done" >&2
219 -echo >&2
220 +gettext "done" >&3
221 +echo >&3
222 +
223 +# close diagnostic stream
224 +exec 3>&-