1 |
%define Werror_cflags %nil |
2 |
# Modules always contain just 32-bit code |
3 |
%define _libdir %{_exec_prefix}/lib |
4 |
%ifarch x86_64 |
5 |
# 64bit intel machines use 32bit boot loader |
6 |
# (We cannot just redefine _target_cpu, as we'd get i386.rpm packages) |
7 |
%global _target_platform i386-%{_vendor}-%{_target_os}%{?_gnu} |
8 |
%global efi_arch x86_64-efi |
9 |
%else |
10 |
%global efi_arch i386-efi |
11 |
%endif |
12 |
|
13 |
%global pc_arch i386-pc |
14 |
|
15 |
Name: grub2 |
16 |
Version: 2.00 |
17 |
Release: %mkrel 58 |
18 |
Summary: Boot-loader with support for Linux, Multiboot and more |
19 |
Group: System/Boot and Init |
20 |
License: GPLv3+ and GPLv2 |
21 |
# unicode font is GPLv2 |
22 |
URL: http://www.gnu.org/software/grub/ |
23 |
Source0: ftp://ftp.gnu.org/gnu/grub/grub-%{version}.tar.xz |
24 |
Source1: 90_persistent |
25 |
Source2: grub.default |
26 |
Source3: README.Mageia |
27 |
Source4: README.efi |
28 |
Source5: grub2.filter |
29 |
Source6: grub2.script |
30 |
Source7: theme.txt |
31 |
# pf2 fonts may be regenerated in SOURCES using ./mkfonts |
32 |
Source8: mkfonts |
33 |
Source9: unicode.pf2 |
34 |
Source10: MageiaLogo-Bold-16.pf2 |
35 |
Source11: MageiaLogo-Bold-20.pf2 |
36 |
Source12: MageiaLogo-Bold-28.pf2 |
37 |
Source13: MageiaLogo-Regular-20.pf2 |
38 |
Source14: Mageia3-grub2-1024x768.png |
39 |
Source15: MageiaLogoFonts-bdf.tar.xz |
40 |
Source16: 93_memtest |
41 |
|
42 |
Patch0: grub2-2.00-bzrignore.patch |
43 |
# Upstream git snapshot |
44 |
Patch1: grub2-2.00-mga-git-9066.patch |
45 |
# Fedora patches not upstream |
46 |
Patch0443: 0443-Migrate-PPC-from-Yaboot-to-Grub2.patch |
47 |
Patch0444: 0444-Add-fw_path-variable-revised.patch |
48 |
Patch0445: 0445-Don-t-set-boot-device-on-ppc-ieee1275.patch |
49 |
Patch0446: 0446-Add-support-for-linuxefi.patch |
50 |
Patch0448: 0448-Use-linuxefi-and-initrdefi-where-appropriate.patch |
51 |
Patch0449: 0449-Don-t-allow-insmod-when-secure-boot-is-enabled.patch |
52 |
Patch0450: 0450-Pass-x-hex-hex-straight-through-unmolested.patch |
53 |
Patch0451: 0451-Fix-crash-on-http.patch |
54 |
Patch0455: 0455-Add-X-option-to-printf-functions.patch |
55 |
Patch0458: 0458-Add-bootpath-device-to-the-list.patch |
56 |
Patch0460: 0460-blscfg-add-blscfg-module-to-parse-Boot-Loader-Specif.patch |
57 |
Patch0462: 0462-for-ppc-reset-console-display-attr-when-clear-screen.patch |
58 |
Patch0468: 0468-Don-t-write-messages-to-the-screen.patch |
59 |
Patch0474: 0474-Message-string-cleanups.patch |
60 |
Patch0476: 0476-Use-the-correct-indentation-for-the-term-help-text.patch |
61 |
Patch0479: 0479-Add-support-for-UEFI-operating-systems-returned-by-o.patch |
62 |
Patch0480: 0480-Disable-GRUB-video-support-for-IBM-power-machines.patch |
63 |
Patch0481: 0481-Revert-Add-bootpath-device-to-the-list-967862.patch |
64 |
Patch0483: 0483-Initialize-grub_file_filters_-all-enabled.patch |
65 |
|
66 |
BuildRequires: flex |
67 |
BuildRequires: bison |
68 |
BuildRequires: ruby |
69 |
BuildRequires: binutils |
70 |
BuildRequires: glibc-static-devel |
71 |
BuildRequires: ncurses-devel |
72 |
BuildRequires: liblzo-devel |
73 |
BuildRequires: freetype2-devel |
74 |
BuildRequires: libusb-devel |
75 |
BuildRequires: help2man |
76 |
BuildRequires: texinfo |
77 |
BuildRequires: libdevmapper-devel |
78 |
BuildRequires: fuse-devel |
79 |
BuildRequires: autogen |
80 |
|
81 |
Conflicts: %{name}-efi |
82 |
Suggests: os-prober >= 1.53 |
83 |
Suggests: %{name}-mageia-theme = %{version}-%{release} |
84 |
Provides: bootloader |
85 |
Provides: grub2bootloader |
86 |
|
87 |
%description |
88 |
This is the second version of the GRUB (Grand Unified Boot-loader), a highly |
89 |
configurable and customizable boot-loader with modular architecture. |
90 |
It supports a wide range of kernel formats, file systems, computer |
91 |
architectures and hardware devices. |
92 |
It may be safely installed alongside legacy grub. |
93 |
Refer to the README.Mageia file that is part of this package's documentation |
94 |
for more information. |
95 |
|
96 |
%package efi |
97 |
Summary: Boot-loader with support for EFI |
98 |
Group: System/Boot and Init |
99 |
|
100 |
Conflicts: %{name} |
101 |
Suggests: os-prober >= 1.53 |
102 |
Requires(post): efibootmgr |
103 |
Suggests: %{name}-mageia-theme = %{version}-%{release} |
104 |
Provides: bootloader |
105 |
Provides: grub2bootloader |
106 |
|
107 |
%description efi |
108 |
This is the second version of the GRUB (Grand Unified Boot-loader), a highly |
109 |
configurable and customizable boot-loader with modular architecture. |
110 |
It supports a wide range of kernel formats, file systems, computer |
111 |
architectures and hardware devices. |
112 |
It may be safely installed alongside legacy grub. |
113 |
Refer to the README.Mageia and README.efi files that are part of this package's |
114 |
documentation for more information. |
115 |
|
116 |
%package mageia-theme |
117 |
Summary: Provides a graphical theme with a custom Mageia background for grub2 |
118 |
Group: System/Boot and Init |
119 |
|
120 |
Requires: grub2bootloader |
121 |
Conflicts: grub2-mageia3-theme-dejavu |
122 |
BuildArch: noarch |
123 |
|
124 |
%description mageia-theme |
125 |
This package provides a custom Mageia graphical theme. |
126 |
It is provided as a separate package so it may be easily excluded from |
127 |
minimal installations where a graphical theme is not required. |
128 |
|
129 |
%prep |
130 |
%setup -q -n grub-%{version} |
131 |
|
132 |
%apply_patches |
133 |
|
134 |
# README.Mageia |
135 |
cp %{SOURCE3} . |
136 |
# README.efi |
137 |
cp %{SOURCE4} . |
138 |
|
139 |
cd .. |
140 |
rm -rf grub-efi-%{version} |
141 |
mv grub-%{version} grub-efi-%{version} |
142 |
|
143 |
%setup -q -n grub-%{version} |
144 |
|
145 |
%apply_patches |
146 |
|
147 |
# README.Mageia |
148 |
cp %{SOURCE3} . |
149 |
# README.efi |
150 |
cp %{SOURCE4} . |
151 |
|
152 |
%build |
153 |
cd .. |
154 |
pushd grub-%{version} |
155 |
./autogen.sh |
156 |
%configure2_5x TARGET_LDFLAGS=-static \ |
157 |
--with-platform=pc \ |
158 |
--enable-grub-emu-usb \ |
159 |
--disable-werror \ |
160 |
--enable-grub-mkfont \ |
161 |
--program-transform-name=s,grub,%{name}, \ |
162 |
--with-bootdir=/boot \ |
163 |
--with-grubdir=/%{name} \ |
164 |
CFLAGS="" |
165 |
%make |
166 |
popd |
167 |
|
168 |
pushd grub-efi-%{version} |
169 |
./autogen.sh |
170 |
%configure2_5x TARGET_LDFLAGS=-static \ |
171 |
--with-platform=efi \ |
172 |
%ifarch x86_64 |
173 |
--target=x86_64 \ |
174 |
%endif |
175 |
--enable-grub-emu-usb \ |
176 |
--disable-werror \ |
177 |
--enable-grub-mkfont \ |
178 |
--program-transform-name=s,grub,%{name}, \ |
179 |
--with-bootdir=/boot \ |
180 |
--with-grubdir=/%{name} \ |
181 |
CFLAGS="" |
182 |
%make |
183 |
popd |
184 |
|
185 |
%install |
186 |
cd .. |
187 |
pushd grub-efi-%{version} |
188 |
%makeinstall_std |
189 |
popd |
190 |
|
191 |
pushd grub-%{version} |
192 |
%makeinstall_std |
193 |
|
194 |
# (bor) grub.info is harcoded in sources |
195 |
mv %{buildroot}%{_infodir}/grub.info %{buildroot}%{_infodir}/%{name}.info |
196 |
|
197 |
# Script that makes part of grub.cfg persist across updates |
198 |
install -m 755 %{SOURCE1} %{buildroot}%{_sysconfdir}/grub.d |
199 |
|
200 |
# Memtest |
201 |
install -m 755 %{SOURCE16} %{buildroot}%{_sysconfdir}/grub.d |
202 |
|
203 |
# Font |
204 |
install -d %{buildroot}/boot/%{name}/fonts |
205 |
install -D %{SOURCE9} %{buildroot}/boot/%{name}/fonts |
206 |
|
207 |
# Theme |
208 |
install -d %{buildroot}/boot/%{name}/themes/maggy |
209 |
install -D %{SOURCE7} %{buildroot}/boot/%{name}/themes/maggy |
210 |
install -D %{SOURCE10} %{buildroot}/boot/%{name}/themes/maggy |
211 |
install -D %{SOURCE11} %{buildroot}/boot/%{name}/themes/maggy |
212 |
install -D %{SOURCE12} %{buildroot}/boot/%{name}/themes/maggy |
213 |
install -D %{SOURCE13} %{buildroot}/boot/%{name}/themes/maggy |
214 |
install -D %{SOURCE14} %{buildroot}/boot/%{name}/themes/maggy |
215 |
|
216 |
# Ghost config files |
217 |
install -d %{buildroot}/boot/%{name} |
218 |
touch %{buildroot}/boot/%{name}/grub.cfg |
219 |
|
220 |
# Workaround for RHL Bug 817187 |
221 |
install -d %{buildroot}%{_datadir}/locale/en/LC_MESSAGES |
222 |
ln -s %{_datadir}/locale/en@quot/LC_MESSAGES/grub.mo %{buildroot}%{_datadir}/locale/en/LC_MESSAGES/grub.mo |
223 |
|
224 |
cat > %{buildroot}/boot/%{name}/custom.cfg <<EOF |
225 |
# Set non-graphical text/background colours |
226 |
set menu_color_normal=cyan/blue |
227 |
set menu_color_highlight=white/blue |
228 |
|
229 |
# Add any extra custom menu entries in here: |
230 |
|
231 |
EOF |
232 |
|
233 |
# Provide 'update-grub' and update-grub2 symlink for *buntu exiles ;) |
234 |
cat > %{buildroot}%{_bindir}/update-grub <<EOF |
235 |
#!/bin/sh |
236 |
su --login root -c "/usr/sbin/grub2-mkconfig -o /boot/grub2/grub.cfg" |
237 |
|
238 |
EOF |
239 |
chmod +x %{buildroot}%{_bindir}/update-grub |
240 |
ln -s %{_bindir}/update-grub %{buildroot}%{_bindir}/update-grub2 |
241 |
|
242 |
# Filetriggers |
243 |
install -d %{buildroot}/%{_filetriggers_dir} |
244 |
install -D %{SOURCE5} %{buildroot}/%{_filetriggers_dir}/%{name}.filter |
245 |
install -D %{SOURCE6} %{buildroot}/%{_filetriggers_dir}/%{name}.script |
246 |
|
247 |
# Defaults |
248 |
install -m 644 -D %{SOURCE2} %{buildroot}%{_sysconfdir}/default/grub |
249 |
|
250 |
# Remove "GNU/Linux" in menu selections |
251 |
sed -i 's/ GNU\/Linux//' %{buildroot}%{_sysconfdir}/grub.d/10_linux |
252 |
|
253 |
%find_lang grub |
254 |
|
255 |
popd |
256 |
|
257 |
%post |
258 |
exec > /var/log/%{name}_post.log 2>&1 |
259 |
# Determine the partition with /boot |
260 |
BOOT_PARTITION=$(df -h /boot |(read; awk '{print $1; exit}')) |
261 |
# make it work with live images |
262 |
if [ "$BOOT_PARTITION" == "overlayfs" ]; then |
263 |
BOOT_PARTITION=$(df -h /mnt/install/boot |(read; awk '{print $1; exit}')) |
264 |
fi |
265 |
|
266 |
# Generate core.img, but don't let it be installed in boot sector |
267 |
%{name}-install --directory=%{_libdir}/grub/%{pc_arch} --grub-setup=/bin/true $BOOT_PARTITION |
268 |
|
269 |
# On update re-install grub2 to where it was installed by drakboot |
270 |
# otherwise next boot may fail due to mismatched boot code. |
271 |
# If grub2 was manually installed (outside drakboot) do nothing. |
272 |
# This will also re-build the menu. |
273 |
if [ $1 -eq 2 ] && [ -e /boot/grub2/drakboot.conf ]; then |
274 |
install_part=$(cat /boot/grub2/drakboot.conf|grep "boot="|cut -d= -f2) |
275 |
root_part=$(df -h / |(read; awk '{print $1; exit}')) |
276 |
if [ "$root_part" != "$install_part" ]; then |
277 |
%{name}-install $install_part |
278 |
fi |
279 |
fi |
280 |
|
281 |
# Generate grub.cfg only on install |
282 |
if [ $1 -eq 1 ]; then |
283 |
%{name}-mkconfig -o /boot/%{name}/grub.cfg |
284 |
fi |
285 |
|
286 |
%post efi |
287 |
exec > /var/log/%{name}_post.log 2>&1 |
288 |
# Determine the partition with /boot |
289 |
BOOT_PARTITION=$(df -h /boot |(read; awk '{print $1; exit}')) |
290 |
# make it work with live images |
291 |
if [ "$BOOT_PARTITION" == "overlayfs" ]; then |
292 |
BOOT_PARTITION=$(df -h /mnt/install/boot |(read; awk '{print $1; exit}')) |
293 |
fi |
294 |
|
295 |
# Generate core.img, but don't let it be installed in boot sector |
296 |
%{name}-install --directory=%{_libdir}/grub/%{efi_arch} --grub-setup=/bin/true $BOOT_PARTITION |
297 |
|
298 |
# On update re-install grub2 to where it was installed by drakboot |
299 |
# otherwise next boot may fail due to mismatched boot code. |
300 |
# If grub2 was manually installed (outside drakboot) do nothing. |
301 |
# This will also re-build the menu. |
302 |
if [ $1 -eq 2 ] && [ -e /boot/grub2/drakboot.conf ]; then |
303 |
install_part=$(cat /boot/grub2/drakboot.conf|grep "boot="|cut -d= -f2) |
304 |
root_part=$(df -h / |(read; awk '{print $1; exit}')) |
305 |
if [ "$root_part" != "$install_part" ]; then |
306 |
%{name}-install $install_part |
307 |
fi |
308 |
fi |
309 |
|
310 |
# Generate grub.cfg only on install |
311 |
if [ $1 -eq 1 ]; then |
312 |
%{name}-mkconfig -o /boot/%{name}/grub.cfg |
313 |
fi |
314 |
|
315 |
%post mageia-theme |
316 |
# Don't install if updating |
317 |
if [ $1 -eq 1 ] ; then |
318 |
# Remove trailing blank lines from /etc/default/grub |
319 |
sed -i -e :a -e '/^\n*$/{$d;N;};/\n$/ba' %{_sysconfdir}/default/grub |
320 |
# Check that /etc/default/grub ends in a linefeed |
321 |
[ "$(tail -n 1 %{_sysconfdir}/default/grub | wc --lines)" = "1" ] || echo >> %{_sysconfdir}/default/grub |
322 |
# Add theme |
323 |
echo "GRUB_THEME=/boot/grub2/themes/maggy/theme.txt" >> %{_sysconfdir}/default/grub |
324 |
fi |
325 |
|
326 |
%preun |
327 |
exec > /var/log/%{name}_preun.log 2>&1 |
328 |
# Only if uninstalling |
329 |
if [ $1 -eq 0 ]; then |
330 |
rm -rf /boot/%{name}/%{pc_arch} |
331 |
rm -rf /boot/%{name}/locale |
332 |
fi |
333 |
|
334 |
%preun efi |
335 |
exec > /var/log/%{name}_preun.log 2>&1 |
336 |
# Only if uninstalling |
337 |
if [ $1 -eq 0 ]; then |
338 |
rm -rf /boot/%{name}/%{efi_arch} |
339 |
rm -rf /boot/%{name}/locale |
340 |
fi |
341 |
|
342 |
%postun mageia-theme |
343 |
exec > /var/log/%{name}_theme_postun.log 2>&1 |
344 |
# Only if uninstalling theme |
345 |
if [ $1 -eq 0 ]; then |
346 |
# Remove theme from config |
347 |
sed -i '/GRUB_THEME=\/boot\/grub2\/themes\/maggy\/theme.txt/d' %{_sysconfdir}/default/grub |
348 |
fi |
349 |
|
350 |
%files -f grub.lang |
351 |
%doc COPYING NEWS README THANKS TODO README.Mageia |
352 |
%{_infodir}/* |
353 |
%dir %{_libdir}/grub |
354 |
%dir %{_libdir}/grub/i386-pc |
355 |
%dir /boot/%{name} |
356 |
%dir /boot/%{name}/fonts |
357 |
%dir /boot/%{name}/themes |
358 |
%{_libdir}/grub/i386-pc/* |
359 |
%{_bindir}/%{name}-* |
360 |
%{_bindir}/update-grub |
361 |
%{_bindir}/update-grub2 |
362 |
%{_sbindir}/%{name}-* |
363 |
%{_sysconfdir}/bash_completion.d/grub |
364 |
%{_sysconfdir}/grub.d/README |
365 |
%{_sysconfdir}/grub.d/00_header |
366 |
%{_sysconfdir}/grub.d/10_linux |
367 |
%{_sysconfdir}/grub.d/20_linux_xen |
368 |
%{_sysconfdir}/grub.d/20_ppc_terminfo |
369 |
%{_sysconfdir}/grub.d/93_memtest |
370 |
%{_sysconfdir}/grub.d/30_os-prober |
371 |
%{_sysconfdir}/grub.d/90_persistent |
372 |
%config(noreplace) %{_sysconfdir}/grub.d/40_custom |
373 |
%config(noreplace) %{_sysconfdir}/grub.d/41_custom |
374 |
%config(noreplace) %{_sysconfdir}/default/grub |
375 |
%{_datadir}/grub |
376 |
%config(noreplace) /boot/%{name}/grub.cfg |
377 |
%config(noreplace) /boot/%{name}/custom.cfg |
378 |
%{_mandir}/man1/%{name}-*.1* |
379 |
%{_mandir}/man8/%{name}-*.8* |
380 |
%{_filetriggers_dir}/%{name}.filter |
381 |
%{_filetriggers_dir}/%{name}.script |
382 |
|
383 |
%files efi -f grub.lang |
384 |
%doc COPYING NEWS README THANKS TODO README.Mageia README.efi |
385 |
%{_infodir}/* |
386 |
%dir %{_libdir}/grub |
387 |
%dir %{_libdir}/grub/%{efi_arch} |
388 |
%dir /boot/%{name} |
389 |
%dir /boot/%{name}/fonts |
390 |
%dir /boot/%{name}/themes |
391 |
%{_libdir}/grub/%{efi_arch}/* |
392 |
%{_bindir}/%{name}-* |
393 |
%{_bindir}/update-grub |
394 |
%{_bindir}/update-grub2 |
395 |
%{_sbindir}/%{name}-* |
396 |
%{_sysconfdir}/bash_completion.d/grub |
397 |
%{_sysconfdir}/grub.d/README |
398 |
%{_sysconfdir}/grub.d/00_header |
399 |
%{_sysconfdir}/grub.d/10_linux |
400 |
%{_sysconfdir}/grub.d/20_linux_xen |
401 |
%{_sysconfdir}/grub.d/20_ppc_terminfo |
402 |
%{_sysconfdir}/grub.d/93_memtest |
403 |
%{_sysconfdir}/grub.d/30_os-prober |
404 |
%{_sysconfdir}/grub.d/90_persistent |
405 |
%config(noreplace) %{_sysconfdir}/grub.d/40_custom |
406 |
%config(noreplace) %{_sysconfdir}/grub.d/41_custom |
407 |
%config(noreplace) %{_sysconfdir}/default/grub |
408 |
%{_datadir}/grub |
409 |
%config(noreplace) /boot/%{name}/grub.cfg |
410 |
%config(noreplace) /boot/%{name}/custom.cfg |
411 |
%{_mandir}/man1/%{name}-*.1* |
412 |
%{_mandir}/man8/%{name}-*.8* |
413 |
%{_filetriggers_dir}/%{name}.filter |
414 |
%{_filetriggers_dir}/%{name}.script |
415 |
|
416 |
%files mageia-theme |
417 |
/boot/%{name}/fonts/unicode.pf2 |
418 |
%dir /boot/%{name}/themes/maggy |
419 |
/boot/%{name}/themes/maggy/* |