1 |
%define Werror_cflags %nil |
2 |
# Modules always contain just 32-bit code |
3 |
%define _libdir %{_exec_prefix}/lib |
4 |
|
5 |
%ifarch x86_64 |
6 |
# 64bit intel machines use 32bit boot loader |
7 |
# (We cannot just redefine _target_cpu, as we'd get i386.rpm packages) |
8 |
%global _target_platform i386-%{_vendor}-%{_target_os}%{?_gnu} |
9 |
%global efi_arch x86_64-efi |
10 |
%endif |
11 |
|
12 |
%ifarch %arm |
13 |
%global efi_arch arm-uboot |
14 |
%endif |
15 |
|
16 |
%ifarch %ix86 |
17 |
%global efi_arch i386-efi |
18 |
%endif |
19 |
|
20 |
%define tarver 2.02~beta2 |
21 |
%global pc_arch i386-pc |
22 |
%define git 10101 |
23 |
%define rel 8 |
24 |
|
25 |
Name: grub2 |
26 |
Version: 2.02 |
27 |
Release: %mkrel -c git%{git} %{rel} |
28 |
Summary: Boot-loader with support for Linux, Multiboot and more |
29 |
Group: System/Boot and Init |
30 |
License: GPLv3+ and GPLv2 |
31 |
# unicode font is GPLv2 |
32 |
URL: http://www.gnu.org/software/grub/ |
33 |
Source0: ftp://ftp.gnu.org/gnu/grub/grub-%{tarver}.tar.xz |
34 |
Source1: 90_persistent |
35 |
Source2: grub.default |
36 |
Source3: README.Mageia |
37 |
Source4: README.efi |
38 |
Source7: theme.txt |
39 |
# pf2 fonts may be regenerated in SOURCES using ./mkfonts |
40 |
Source8: mkfonts |
41 |
Source9: unicode.pf2 |
42 |
Source10: MageiaLogo-Bold-16.pf2 |
43 |
Source11: MageiaLogo-Bold-20.pf2 |
44 |
Source12: MageiaLogo-Bold-28.pf2 |
45 |
Source13: MageiaLogo-Regular-20.pf2 |
46 |
Source14: Mageia5-grub2-1024x768.png |
47 |
Source15: MageiaLogoFonts-bdf.tar.xz |
48 |
Source16: gitignore |
49 |
|
50 |
# Upstream git snapshot |
51 |
Patch1: grub2-grub-2.02-beta2-mga-git-%{git}.patch |
52 |
# fix CVE-2014-4607 in bundled minilzo |
53 |
Patch2: grub-2.00-minilzo.patch |
54 |
Patch3: grub2-2.00-mga-add_failsafe-10_linux.in.patch |
55 |
|
56 |
# Fedora patches not upstream |
57 |
Patch0101: 0443-Migrate-PPC-from-Yaboot-to-Grub2.patch |
58 |
Patch0102: 0450-Pass-x-hex-hex-straight-through-unmolested.patch |
59 |
Patch0103: 0451-Fix-crash-on-http.patch |
60 |
Patch0104: 0460-blscfg-add-blscfg-module-to-parse-Boot-Loader-Specif.patch |
61 |
Patch0105: 0462-for-ppc-reset-console-display-attr-when-clear-screen.patch |
62 |
Patch0106: 0476-Use-the-correct-indentation-for-the-term-help-text.patch |
63 |
Patch0107: 0126-Don-t-munge-raw-spaces-when-we-re-doing-our-cmdline-.patch |
64 |
Patch0108: 0039-Don-t-require-a-password-to-boot-entries-generated-b.patch |
65 |
Patch0109: 0040-Don-t-emit-Booting-.-message.patch |
66 |
Patch0110: 0041-Make-CTRL-and-ALT-keys-work-as-expected-on-EFI-syste.patch |
67 |
Patch0111: 0042-May-as-well-try-it.patch |
68 |
Patch0114: 0045-trim-arp-packets-with-abnormal-size.patch |
69 |
Patch0115: 0046-Fix-convert-function-to-support-NVMe-devices.patch |
70 |
Patch0116: 0047-Fix-bad-test-on-GRUB_DISABLE_SUBMENU.patch |
71 |
Patch0119: 0050-reopen-SNP-protocol-for-exclusive-use-by-grub.patch |
72 |
Patch0120: 0051-Reduce-timer-event-frequency-by-10.patch |
73 |
Patch0121: 0052-always-return-error-to-UEFI.patch |
74 |
Patch0122: 0053-Suport-for-bi-endianess-in-elf-file.patch |
75 |
Patch0123: 0054-Add-grub_util_readlink.patch |
76 |
Patch0124: 0055-Make-editenv-chase-symlinks-including-those-across-d.patch |
77 |
Patch0126: 0057-Fix-GRUB_DISABLE_SUBMENU-one-more-time.patch |
78 |
Patch0127: 0058-Minimize-the-sort-ordering-for-.debug-and-rescue-ker.patch |
79 |
Patch0128: 0059-Add-GRUB_DISABLE_UUID.patch |
80 |
Patch0129: 0060-Allow-fallback-to-include-entries-by-title-not-just-.patch |
81 |
Patch0132: 0063-Try-to-emit-linux16-initrd16-and-linuxefi-initrdefi-.patch |
82 |
Patch0134: 0065-Make-grub2-mkconfig-construct-titles-that-look-like-.patch |
83 |
Patch0135: 0066-Make-rescue-and-debug-entries-sort-right-again-in-gr.patch |
84 |
Patch0136: 0067-Make-.gitignore-suck-way-less.patch |
85 |
Patch0137: 0068-Update-info-with-grub.cfg-netboot-selection-order-11.patch |
86 |
Patch0138: 0069-Use-Distribution-Package-Sort-for-grub2-mkconfig-112.patch |
87 |
Patch0139: 0070-Add-friendly-grub2-password-config-tool-985962.patch |
88 |
Patch0140: 0071-Make-exit-take-a-return-code.patch |
89 |
Patch0143: 0074-Mark-po-exclude.pot-as-binary-so-git-won-t-try-to-di.patch |
90 |
Patch0144: 10001-Put-the-correct-.file-directives-in-our-.S-files.patch |
91 |
Patch0145: 10002-Make-efi-machines-load-an-env-block-from-a-variable.patch |
92 |
Patch0146: 10003-Make-it-possible-to-enabled-build-id-sha1.patch |
93 |
Patch0147: 10005-Add-grub_qdprintf-grub_dprintf-without-the-file-line.patch |
94 |
Patch0148: 10006-Make-a-gdb-dprintf-that-tells-us-load-addresses.patch |
95 |
Patch0149: 0075-Fix-security-issue-when-reading-username-and-passwor.patch |
96 |
Patch0150: 0076-01_users-Handle-GRUB_PASSWORD-better.patch |
97 |
|
98 |
Patch0151: grub2-2.02-mga-fix_halt_at_grub_prompt.patch |
99 |
|
100 |
BuildRequires: flex |
101 |
BuildRequires: bison |
102 |
BuildRequires: ruby |
103 |
BuildRequires: binutils |
104 |
BuildRequires: glibc-static-devel |
105 |
BuildRequires: ncurses-devel |
106 |
BuildRequires: liblzo-devel |
107 |
BuildRequires: pkgconfig(freetype2) |
108 |
BuildRequires: pkgconfig(libusb) |
109 |
BuildRequires: help2man |
110 |
BuildRequires: texinfo |
111 |
BuildRequires: libdevmapper-devel |
112 |
BuildRequires: fuse-devel |
113 |
BuildRequires: autogen |
114 |
BuildRequires: pkgconfig(liblzma) |
115 |
BuildRequires: pkgconfig(rpm) |
116 |
|
117 |
Conflicts: %{name}-efi |
118 |
Provides: bootloader |
119 |
Provides: grub2bootloader = %{version}-%{release} |
120 |
Requires: %{name}-common = %{version}-%{release} |
121 |
|
122 |
%description |
123 |
This is the second version of the GRUB (Grand Unified Boot-loader), a highly |
124 |
configurable and customizable boot-loader with modular architecture. |
125 |
It supports a wide range of kernel formats, file systems, computer |
126 |
architectures and hardware devices. |
127 |
Refer to the README.Mageia file that is part of this package's documentation |
128 |
for more information. |
129 |
|
130 |
%ifnarch %arm |
131 |
%package efi |
132 |
Summary: Boot-loader with support for EFI |
133 |
Group: System/Boot and Init |
134 |
|
135 |
Conflicts: %{name} |
136 |
Requires(post): efibootmgr |
137 |
Provides: bootloader |
138 |
Provides: grub2bootloader = %{version}-%{release} |
139 |
Requires: %{name}-common = %{version}-%{release} |
140 |
|
141 |
%description efi |
142 |
This is the second version of the GRUB (Grand Unified Boot-loader), a highly |
143 |
configurable and customizable boot-loader with modular architecture. |
144 |
It supports a wide range of kernel formats, file systems, computer |
145 |
architectures and hardware devices. |
146 |
************************** WARNING ************************ |
147 |
Do not attempt to install this package on a system which is not |
148 |
already using UEFI mode to boot. You cannot switch to UEFI mode by installing |
149 |
this package, the system must be installed in UEFI mode to use it, when it |
150 |
will be installed by default. |
151 |
%endif |
152 |
|
153 |
%ifarch %arm |
154 |
%package uboot |
155 |
Summary: Boot-loader with support for UBOOT |
156 |
Group: System/Boot and Init |
157 |
|
158 |
Provides: bootloader |
159 |
Provides: grub2bootloader = %{version}-%{release} |
160 |
Requires: %{name}-common = %{version}-%{release} |
161 |
|
162 |
%description uboot |
163 |
configurable and customizable boot-loader with modular architecture. |
164 |
It supports a wide range of kernel formats, file systems, computer |
165 |
architectures and hardware devices. |
166 |
%endif |
167 |
|
168 |
%package common |
169 |
Summary: Provides files common to both grub2 and grub2-efi |
170 |
Group: System/Boot and Init |
171 |
Conflicts: memtest86+ < 5.01-7 |
172 |
Conflicts: %{name} < 2.02-0.git9752.19.mga5 |
173 |
Conflicts: %{name}-efi < 2.02-0.git9752.19.mga5 |
174 |
Recommends: %{name}-mageia-theme = %{version}-%{release} |
175 |
Recommends: os-prober >= 1.53 |
176 |
Recommends: xorriso |
177 |
Recommends: memtest86+ >= 5.01-7 |
178 |
Requires: grub2bootloader = %{version}-%{release} |
179 |
|
180 |
%description common |
181 |
Common files used by both grub2 and grub2-efi. |
182 |
|
183 |
%package mageia-theme |
184 |
Summary: Provides a graphical theme with a custom Mageia background for grub2 |
185 |
Group: System/Boot and Init |
186 |
|
187 |
Requires: grub2bootloader = %{version}-%{release} |
188 |
Conflicts: grub2-mageia3-theme-dejavu |
189 |
BuildArch: noarch |
190 |
|
191 |
%description mageia-theme |
192 |
This package provides a custom Mageia graphical theme. |
193 |
It is provided as a separate package so it may be easily excluded from |
194 |
minimal installations where a graphical theme is not required. |
195 |
|
196 |
%prep |
197 |
%setup -q -n grub-%{tarver} |
198 |
|
199 |
cp %{SOURCE16} .gitignore |
200 |
%autopatch -p1 |
201 |
find . -name "*.0???" -delete |
202 |
|
203 |
# README.Mageia |
204 |
cp %{SOURCE3} . |
205 |
|
206 |
%ifnarch %arm |
207 |
# README.efi |
208 |
cp %{SOURCE4} . |
209 |
|
210 |
cd .. |
211 |
rm -rf grub-efi-%{tarver} |
212 |
mv grub-%{tarver} grub-efi-%{tarver} |
213 |
%endif |
214 |
|
215 |
%setup -q -n grub-%{tarver} |
216 |
|
217 |
cp %{SOURCE16} .gitignore |
218 |
%autopatch -p1 |
219 |
find . -name "*.0???" -delete |
220 |
|
221 |
# README.Mageia |
222 |
cp %{SOURCE3} . |
223 |
# README.efi |
224 |
cp %{SOURCE4} . |
225 |
|
226 |
%build |
227 |
cd .. |
228 |
pushd grub-%{tarver} |
229 |
./autogen.sh |
230 |
%configure2_5x TARGET_LDFLAGS=-static \ |
231 |
%ifarch %arm |
232 |
--with-platform=uboot \ |
233 |
%else |
234 |
--with-platform=pc \ |
235 |
%endif |
236 |
--enable-grub-emu-usb \ |
237 |
--disable-werror \ |
238 |
--enable-grub-mkfont \ |
239 |
--program-transform-name=s,grub,%{name}, \ |
240 |
--with-bootdir=/boot \ |
241 |
--with-grubdir=/%{name} \ |
242 |
CFLAGS="" |
243 |
%make |
244 |
popd |
245 |
|
246 |
%ifnarch %arm |
247 |
pushd grub-efi-%{tarver} |
248 |
./autogen.sh |
249 |
%configure2_5x TARGET_LDFLAGS=-static \ |
250 |
--with-platform=efi \ |
251 |
%ifarch x86_64 |
252 |
--target=x86_64 \ |
253 |
%endif |
254 |
--enable-grub-emu-usb \ |
255 |
--disable-werror \ |
256 |
--enable-grub-mkfont \ |
257 |
--program-transform-name=s,grub,%{name}, \ |
258 |
--with-bootdir=/boot \ |
259 |
--with-grubdir=/%{name} \ |
260 |
CFLAGS="" |
261 |
%make |
262 |
popd |
263 |
%endif |
264 |
|
265 |
%install |
266 |
cd .. |
267 |
%ifnarch %arm |
268 |
pushd grub-efi-%{tarver} |
269 |
%makeinstall_std |
270 |
popd |
271 |
%endif |
272 |
|
273 |
pushd grub-%{tarver} |
274 |
%makeinstall_std |
275 |
|
276 |
# (bor) grub.info is harcoded in sources |
277 |
mv %{buildroot}%{_infodir}/grub.info %{buildroot}%{_infodir}/%{name}.info |
278 |
|
279 |
# Script that makes part of grub.cfg persist across updates |
280 |
install -m 755 %{SOURCE1} %{buildroot}%{_sysconfdir}/grub.d |
281 |
|
282 |
# Font |
283 |
install -d %{buildroot}/boot/%{name}/fonts |
284 |
install -D %{SOURCE9} %{buildroot}/boot/%{name}/fonts |
285 |
|
286 |
# Theme |
287 |
install -d %{buildroot}/boot/%{name}/themes/maggy |
288 |
install -D %{SOURCE7} %{buildroot}/boot/%{name}/themes/maggy |
289 |
install -D %{SOURCE10} %{buildroot}/boot/%{name}/themes/maggy |
290 |
install -D %{SOURCE11} %{buildroot}/boot/%{name}/themes/maggy |
291 |
install -D %{SOURCE12} %{buildroot}/boot/%{name}/themes/maggy |
292 |
install -D %{SOURCE13} %{buildroot}/boot/%{name}/themes/maggy |
293 |
install -D %{SOURCE14} %{buildroot}/boot/%{name}/themes/maggy |
294 |
|
295 |
# Ghost config files |
296 |
install -d %{buildroot}/boot/%{name} |
297 |
|
298 |
# Workaround for RHL Bug 817187 |
299 |
install -d %{buildroot}%{_datadir}/locale/en/LC_MESSAGES |
300 |
ln -s %{_datadir}/locale/en@quot/LC_MESSAGES/grub.mo %{buildroot}%{_datadir}/locale/en/LC_MESSAGES/grub.mo |
301 |
|
302 |
cat > %{buildroot}/boot/%{name}/custom.cfg <<EOF |
303 |
# Set non-graphical text/background colours |
304 |
set menu_color_normal=cyan/blue |
305 |
set menu_color_highlight=white/blue |
306 |
|
307 |
# Add any extra custom menu entries in here: |
308 |
|
309 |
EOF |
310 |
|
311 |
# Provide 'update-grub' and update-grub2 symlink for *buntu exiles ;) |
312 |
cat > %{buildroot}%{_bindir}/update-grub <<EOF |
313 |
#!/bin/sh |
314 |
su --login root -c "/usr/sbin/grub2-mkconfig -o /boot/grub2/grub.cfg" |
315 |
|
316 |
EOF |
317 |
chmod +x %{buildroot}%{_bindir}/update-grub |
318 |
ln -s %{_bindir}/update-grub %{buildroot}%{_bindir}/update-grub2 |
319 |
|
320 |
# Defaults |
321 |
install -m 644 -D %{SOURCE2} %{buildroot}%{_sysconfdir}/default/grub |
322 |
|
323 |
# Remove "GNU/Linux" in menu selections |
324 |
sed -i 's/ GNU\/Linux//' %{buildroot}%{_sysconfdir}/grub.d/10_linux |
325 |
|
326 |
%find_lang grub |
327 |
|
328 |
popd |
329 |
|
330 |
%post |
331 |
# On update re-install grub2 to where it was installed by drakboot if possible, |
332 |
# otherwise next boot may fail due to mismatched boot code. |
333 |
|
334 |
if [ $1 -eq 2 ]; then |
335 |
if [ -f /boot/grub2/install.sh -a -x /usr/sbin/detectloader ]; then |
336 |
LOADER=$(/usr/sbin/detectloader) |
337 |
[ "$LOADER" = "GRUB2" ] && /boot/grub2/install.sh ||: |
338 |
fi |
339 |
rm -f /etc/default/grub.rpm* |
340 |
fi |
341 |
|
342 |
%ifnarch %arm |
343 |
%post efi |
344 |
# On update re-install grub2 to where it was installed by drakboot if possible, |
345 |
# otherwise next boot may fail due to mismatched boot code. |
346 |
|
347 |
if [ $1 -eq 2 ]; then |
348 |
if [ -f /boot/grub2/install.sh -a -x /usr/sbin/detectloader ]; then |
349 |
LOADER=$(/usr/sbin/detectloader) |
350 |
[ "$LOADER" = "GRUB2" ] && /boot/grub2/install.sh ||: |
351 |
fi |
352 |
rm -f /etc/default/grub.rpm* |
353 |
fi |
354 |
%endif |
355 |
|
356 |
%post mageia-theme |
357 |
# Don't install if updating |
358 |
if [ $1 -eq 1 ] ; then |
359 |
# Remove trailing blank lines from /etc/default/grub |
360 |
sed -i -e :a -e '/^\n*$/{$d;N;};/\n$/ba' %{_sysconfdir}/default/grub |
361 |
# Check that /etc/default/grub ends in a linefeed |
362 |
[ "$(tail -n 1 %{_sysconfdir}/default/grub | wc --lines)" = "1" ] || echo >> %{_sysconfdir}/default/grub |
363 |
# Add theme |
364 |
echo "GRUB_THEME=/boot/grub2/themes/maggy/theme.txt" >> %{_sysconfdir}/default/grub |
365 |
fi |
366 |
|
367 |
# If updating from below 2.02-0.git10101.4 then re-make grub.cfg once. |
368 |
# grub2 dropped ownership of grub.cfg to avoid rpmnew being created. |
369 |
# Remove rpmnew and after new grub.cfg is created remove rpmsave. |
370 |
%triggerpostun common -- %{name} < 2.02-0.git10101.4, %{name}-efi < 2.02-0.git10101.4 |
371 |
rm -f /boot/%{name}/grub.cfg.rpmnew |
372 |
%{name}-mkconfig -o /boot/%{name}/grub.cfg && rm -f /boot/%{name}/grub.cfg.rpmsave |
373 |
# Take this opportunity to remove some unwanted logs |
374 |
rm -f /var/log/%{name}_preun.log |
375 |
rm -f /var/log/%{name}_post.log |
376 |
rm -f /var/log/%{name}_theme_postun.log |
377 |
|
378 |
%preun |
379 |
# Only if uninstalling |
380 |
if [ $1 -eq 0 ]; then |
381 |
rm -rf /boot/%{name}/%{pc_arch} |
382 |
rm -rf /boot/%{name}/locale |
383 |
fi |
384 |
|
385 |
%ifnarch %arm |
386 |
%preun efi |
387 |
# Only if uninstalling |
388 |
if [ $1 -eq 0 ]; then |
389 |
rm -rf /boot/%{name}/%{efi_arch} |
390 |
rm -rf /boot/%{name}/locale |
391 |
fi |
392 |
%endif |
393 |
|
394 |
%postun mageia-theme |
395 |
# Only if uninstalling theme |
396 |
if [ $1 -eq 0 ]; then |
397 |
# Remove theme from config |
398 |
sed -i '/GRUB_THEME=\/boot\/grub2\/themes\/maggy\/theme.txt/d' %{_sysconfdir}/default/grub |
399 |
fi |
400 |
|
401 |
%files |
402 |
%dir %{_libdir}/grub |
403 |
%ifnarch %arm |
404 |
%dir %{_libdir}/grub/i386-pc |
405 |
%{_libdir}/grub/i386-pc/* |
406 |
%endif |
407 |
|
408 |
%ifnarch %arm |
409 |
%files efi |
410 |
%doc README.efi |
411 |
%dir %{_libdir}/grub |
412 |
%dir %{_libdir}/grub/%{efi_arch} |
413 |
%{_libdir}/grub/%{efi_arch}/* |
414 |
%endif |
415 |
|
416 |
%ifarch %arm |
417 |
%files uboot |
418 |
%dir %{_libdir}/grub |
419 |
%dir %{_libdir}/grub/%{efi_arch} |
420 |
%{_libdir}/grub/%{efi_arch}/* |
421 |
%endif |
422 |
|
423 |
%files common -f grub.lang |
424 |
%doc COPYING NEWS README THANKS TODO README.Mageia |
425 |
%dir /boot/%{name} |
426 |
%dir /boot/%{name}/fonts |
427 |
%dir /boot/%{name}/themes |
428 |
%{_infodir}/* |
429 |
%{_bindir}/%{name}-* |
430 |
%{_bindir}/update-grub |
431 |
%{_bindir}/update-grub2 |
432 |
%{_sbindir}/%{name}-* |
433 |
%{_sysconfdir}/bash_completion.d/grub |
434 |
%{_sysconfdir}/grub.d/README |
435 |
%{_sysconfdir}/grub.d/00_header |
436 |
%{_sysconfdir}/grub.d/01_users |
437 |
%{_sysconfdir}/grub.d/10_linux |
438 |
%{_sysconfdir}/grub.d/20_linux_xen |
439 |
%{_sysconfdir}/grub.d/20_ppc_terminfo |
440 |
%{_sysconfdir}/grub.d/30_os-prober |
441 |
%{_sysconfdir}/grub.d/90_persistent |
442 |
%config(noreplace) %{_sysconfdir}/grub.d/40_custom |
443 |
%config(noreplace) %{_sysconfdir}/grub.d/41_custom |
444 |
%config(noreplace) %{_sysconfdir}/default/grub |
445 |
%{_datadir}/grub |
446 |
%config(noreplace) /boot/%{name}/custom.cfg |
447 |
%{_mandir}/man1/%{name}-*.1* |
448 |
%{_mandir}/man8/%{name}-*.8* |
449 |
|
450 |
%files mageia-theme |
451 |
/boot/%{name}/fonts/unicode.pf2 |
452 |
%dir /boot/%{name}/themes/maggy |
453 |
/boot/%{name}/themes/maggy/* |