1 |
%define Werror_cflags %nil |
2 |
# Modules always contain just 32-bit code |
3 |
%define _libdir %{_exec_prefix}/lib |
4 |
|
5 |
# 64bit intel machines use 32bit boot loader |
6 |
# (We cannot just redefine _target_cpu, as we'd get i386.rpm packages then) |
7 |
%ifarch x86_64 |
8 |
%define _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 |
%global tarversion 2.02~beta3 |
21 |
%global pc_arch i386-pc |
22 |
%define git 10463 |
23 |
%define rel 4 |
24 |
|
25 |
Name: grub2 |
26 |
Version: 2.02 |
27 |
Release: %mkrel -c git%{git} %{rel} |
28 |
Summary: Bootloader 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://alpha.gnu.org/gnu/grub/grub-%{tarversion}.tar.xz |
34 |
#Source0: ftp://ftp.gnu.org/gnu/grub/grub-%%{tarversion}.tar.xz |
35 |
Source2: grub.default |
36 |
Source3: README.Mageia |
37 |
Source4: README.efi |
38 |
Source6: gitignore |
39 |
Source7: grub.patches |
40 |
# pf2 fonts may be regenerated in SOURCES using ./mkfonts |
41 |
Source8: mkfonts |
42 |
Source9: unicode.pf2 |
43 |
Source10: MageiaLogo-Bold-16.pf2 |
44 |
Source11: MageiaLogo-Bold-20.pf2 |
45 |
Source12: MageiaLogo-Bold-28.pf2 |
46 |
Source13: MageiaLogo-Regular-20.pf2 |
47 |
Source14: grub2-mageia-default.png |
48 |
Source15: MageiaLogoFonts-bdf.tar.gz |
49 |
Source20: theme.txt |
50 |
|
51 |
# |
52 |
# Fedora patches: |
53 |
# |
54 |
# generate with do-rebase |
55 |
# Include Fedora patches in Source7 |
56 |
%{expand:%(while read line; do echo $line; done < %{SOURCE7})} |
57 |
|
58 |
# And these are: |
59 |
# git checkout debuginfo |
60 |
# git format-patch fedora-23.. |
61 |
Patch10001: 10001-Put-the-correct-.file-directives-in-our-.S-files.patch |
62 |
Patch10002: 10002-Make-it-possible-to-enabled-build-id-sha1.patch |
63 |
Patch10004: 10004-Add-grub_qdprintf-grub_dprintf-without-the-file-lin.patch |
64 |
Patch10005: 10005-Make-a-gdb-dprintf-that-tells-us-load-addresses.patch |
65 |
|
66 |
# |
67 |
# Mga patches: |
68 |
# |
69 |
Patch20001: grub2-2.00-mga-add_failsafe-10_linux.in.patch |
70 |
Patch20002: grub2-2.00-mga-dont_write_sparse_file_error_to_screen.patch |
71 |
Patch20003: grub2-2.00-mga-dont_write_diskfilter_error_to_screen.patch |
72 |
Patch20004: grub2-2.00-mga-dont_check_uuid_in_installer.patch |
73 |
# |
74 |
# SuSE Patch: |
75 |
# |
76 |
# Fixes Mga#15846 - Grub2 doesn't install the bootloader on btrfs if we |
77 |
# have a dualboot with windows starting at sector 63 |
78 |
Patch30001: grub2-setup-try-fs-embed-if-mbr-gap-too-small.patch |
79 |
|
80 |
BuildRequires: autoconf |
81 |
BuildRequires: autogen |
82 |
BuildRequires: automake |
83 |
BuildRequires: binutils |
84 |
BuildRequires: bison |
85 |
BuildRequires: bzip2-devel |
86 |
BuildRequires: device-mapper-devel |
87 |
BuildRequires: flex |
88 |
BuildRequires: freetype2-devel |
89 |
BuildRequires: freetype-devel |
90 |
BuildRequires: freetype-devel |
91 |
BuildRequires: fuse-devel |
92 |
BuildRequires: gettext-devel |
93 |
BuildRequires: git |
94 |
BuildRequires: glibc-static-devel |
95 |
BuildRequires: help2man |
96 |
BuildRequires: liblzo-devel |
97 |
BuildRequires: libusb-devel |
98 |
BuildRequires: ncurses-devel |
99 |
BuildRequires: python |
100 |
BuildRequires: rpm-devel |
101 |
BuildRequires: ruby |
102 |
BuildRequires: texinfo |
103 |
|
104 |
Conflicts: %{name}-efi |
105 |
Provides: bootloader |
106 |
Provides: grub2bootloader = %{version}-%{release} |
107 |
Requires: %{name}-common = %{version}-%{release} |
108 |
|
109 |
%description |
110 |
This is the second version of the GRUB (Grand Unified Boot-loader), a highly |
111 |
configurable and customizable boot-loader with modular architecture. |
112 |
It supports a wide range of kernel formats, file systems, computer |
113 |
architectures and hardware devices. |
114 |
Refer to the README.Mageia file that is part of this package's documentation |
115 |
for more information. |
116 |
|
117 |
%ifnarch %arm |
118 |
%package efi |
119 |
Summary: Boot-loader with support for EFI |
120 |
Group: System/Boot and Init |
121 |
|
122 |
Conflicts: %{name} |
123 |
Requires(post): efibootmgr |
124 |
Provides: bootloader |
125 |
Provides: grub2bootloader = %{version}-%{release} |
126 |
Requires: %{name}-common = %{version}-%{release} |
127 |
|
128 |
%description efi |
129 |
This is the second version of the GRUB (Grand Unified Boot-loader), a highly |
130 |
configurable and customizable boot-loader with modular architecture. |
131 |
It supports a wide range of kernel formats, file systems, computer |
132 |
architectures and hardware devices. |
133 |
************************** WARNING ************************ |
134 |
Do not attempt to install this package on a system which is not |
135 |
already using UEFI mode to boot. You cannot switch to UEFI mode by installing |
136 |
this package, the system must be installed in UEFI mode to use it, when it |
137 |
will be installed by default. |
138 |
%endif |
139 |
|
140 |
%ifarch %arm |
141 |
%package uboot |
142 |
Summary: Boot-loader with support for UBOOT |
143 |
Group: System/Boot and Init |
144 |
|
145 |
Provides: bootloader |
146 |
Provides: grub2bootloader = %{version}-%{release} |
147 |
Requires: %{name}-common = %{version}-%{release} |
148 |
|
149 |
%description uboot |
150 |
configurable and customizable boot-loader with modular architecture. |
151 |
It supports a wide range of kernel formats, file systems, computer |
152 |
architectures and hardware devices. |
153 |
%endif |
154 |
|
155 |
%package common |
156 |
Summary: Provides files common to both grub2 and grub2-efi |
157 |
Group: System/Boot and Init |
158 |
Conflicts: memtest86+ < 5.01-7 |
159 |
Conflicts: %{name} < 2.02-0.git9752.19.mga5 |
160 |
Conflicts: %{name}-efi < 2.02-0.git9752.19.mga5 |
161 |
Recommends: os-prober >= 1.53 |
162 |
Recommends: xorriso |
163 |
Requires: grub2bootloader = %{version}-%{release} |
164 |
|
165 |
%description common |
166 |
Common files used by both grub2 and grub2-efi. |
167 |
|
168 |
%package mageia-theme |
169 |
Summary: Provides a graphical theme with a custom Mageia background for grub2 |
170 |
Group: System/Boot and Init |
171 |
|
172 |
Requires: grub2bootloader = %{version} |
173 |
Requires(post): sed |
174 |
Requires(post): coreutils |
175 |
Conflicts: grub2-mageia3-theme-dejavu |
176 |
Conflicts: grub2-mageia4-theme-dejavu |
177 |
Conflicts: grub2-mageia5-theme-dejavu |
178 |
Conflicts: grub2-mageia6-theme-dejavu |
179 |
Conflicts: grub2-mageia-theme-dejavu |
180 |
|
181 |
BuildArch: noarch |
182 |
|
183 |
%description mageia-theme |
184 |
This package provides a custom Mageia graphical theme. |
185 |
It is provided as a separate package so it may be easily excluded from |
186 |
minimal installations where a graphical theme is not required. |
187 |
|
188 |
%prep |
189 |
%setup -q -n grub-%{tarversion} |
190 |
|
191 |
cp %{SOURCE6} .gitignore |
192 |
git init |
193 |
echo '![[:digit:]][[:digit:]]_*.in' > util/grub.d/.gitignore |
194 |
echo '!*.[[:digit:]]' > util/.gitignore |
195 |
git config user.email "%{name}-owner@fedoraproject.org" |
196 |
git config user.name "Fedora Ninjas" |
197 |
git config gc.auto 0 |
198 |
git add . |
199 |
git commit -a -q -m "%{tarversion} baseline." |
200 |
git apply %{patches} </dev/null |
201 |
git config --unset user.email |
202 |
git config --unset user.name |
203 |
|
204 |
# README.Mageia |
205 |
cp %{SOURCE3} . |
206 |
|
207 |
%ifnarch %arm |
208 |
# README.efi |
209 |
cp %{SOURCE4} . |
210 |
|
211 |
cd .. |
212 |
rm -rf grub-efi-%{tarversion} |
213 |
mv grub-%{tarversion} grub-efi-%{tarversion} |
214 |
%endif |
215 |
|
216 |
%setup -q -n grub-%{tarversion} |
217 |
|
218 |
cp %{SOURCE6} .gitignore |
219 |
git init |
220 |
echo '![[:digit:]][[:digit:]]_*.in' > util/grub.d/.gitignore |
221 |
echo '!*.[[:digit:]]' > util/.gitignore |
222 |
git config user.email "%{name}-owner@fedoraproject.org" |
223 |
git config user.name "Fedora Ninjas" |
224 |
git config gc.auto 0 |
225 |
git add . |
226 |
git commit -a -q -m "%{tarversion} baseline." |
227 |
git apply %{patches} </dev/null |
228 |
git config --unset user.email |
229 |
git config --unset user.name |
230 |
find . -name "*.0???" -delete |
231 |
|
232 |
# README.Mageia |
233 |
cp %{SOURCE3} . |
234 |
# README.efi |
235 |
cp %{SOURCE4} . |
236 |
|
237 |
%build |
238 |
cd .. |
239 |
pushd grub-%{tarversion} |
240 |
./autogen.sh |
241 |
%configure2_5x TARGET_LDFLAGS=-static \ |
242 |
%ifarch %arm |
243 |
--with-platform=uboot \ |
244 |
%else |
245 |
--with-platform=pc \ |
246 |
%endif |
247 |
--disable-werror \ |
248 |
--enable-grub-mkfont \ |
249 |
--program-transform-name=s,grub,%{name}, \ |
250 |
--with-bootdir=/boot \ |
251 |
--with-grubdir=/%{name} \ |
252 |
CFLAGS="" |
253 |
%make_build |
254 |
popd |
255 |
|
256 |
%ifnarch %arm |
257 |
pushd grub-efi-%{tarversion} |
258 |
./autogen.sh |
259 |
%configure2_5x TARGET_LDFLAGS=-static \ |
260 |
--with-platform=efi \ |
261 |
%ifarch x86_64 |
262 |
--target=x86_64 \ |
263 |
%endif |
264 |
--disable-werror \ |
265 |
--enable-grub-mkfont \ |
266 |
--program-transform-name=s,grub,%{name}, \ |
267 |
--with-bootdir=/boot \ |
268 |
--with-grubdir=/%{name} \ |
269 |
CFLAGS="" |
270 |
%make_build |
271 |
popd |
272 |
%endif |
273 |
|
274 |
%install |
275 |
cd .. |
276 |
%ifnarch %arm |
277 |
pushd grub-efi-%{tarversion} |
278 |
%make_install |
279 |
popd |
280 |
%endif |
281 |
|
282 |
pushd grub-%{tarversion} |
283 |
%make_install |
284 |
|
285 |
# (bor) grub.info is harcoded in sources |
286 |
mv %{buildroot}%{_infodir}/grub.info %{buildroot}%{_infodir}/%{name}.info |
287 |
|
288 |
# Theme |
289 |
install -d %{buildroot}/boot/%{name}/themes/maggy |
290 |
install -D -m 644 %{SOURCE20} %{buildroot}/boot/%{name}/themes/maggy |
291 |
install -D -m 644 %{SOURCE10} %{buildroot}/boot/%{name}/themes/maggy |
292 |
install -D -m 644 %{SOURCE11} %{buildroot}/boot/%{name}/themes/maggy |
293 |
install -D -m 644 %{SOURCE12} %{buildroot}/boot/%{name}/themes/maggy |
294 |
install -D -m 644 %{SOURCE13} %{buildroot}/boot/%{name}/themes/maggy |
295 |
# Install 4:3 default in case default.jpg is missing |
296 |
install -D -m 644 %{SOURCE14} %{buildroot}/boot/%{name}/themes |
297 |
ln -sf ../grub2-mageia-default.png %{buildroot}/boot/%{name}/themes/maggy/grub2-mageia-default.png |
298 |
|
299 |
# Ghost config files |
300 |
install -d %{buildroot}/boot/%{name} |
301 |
install -d %{buildroot}/boot/%{name}/fonts |
302 |
|
303 |
# Workaround for RHL Bug 817187 |
304 |
install -d %{buildroot}%{_datadir}/locale/en/LC_MESSAGES |
305 |
ln -s %{_datadir}/locale/en@quot/LC_MESSAGES/grub.mo %{buildroot}%{_datadir}/locale/en/LC_MESSAGES/grub.mo |
306 |
|
307 |
cat > %{buildroot}/boot/%{name}/custom.cfg <<EOF |
308 |
# Add any extra custom menu entries in here: |
309 |
|
310 |
EOF |
311 |
|
312 |
# Provide 'update-grub' and update-grub2 symlink for *buntu exiles ;) |
313 |
cat > %{buildroot}%{_bindir}/update-grub <<EOF |
314 |
#!/bin/sh |
315 |
su --login root -c "/usr/sbin/grub2-mkconfig -o /boot/grub2/grub.cfg" |
316 |
|
317 |
EOF |
318 |
chmod +x %{buildroot}%{_bindir}/update-grub |
319 |
ln -s %{_bindir}/update-grub %{buildroot}%{_bindir}/update-grub2 |
320 |
|
321 |
# Defaults |
322 |
install -m 644 -D %{SOURCE2} %{buildroot}%{_sysconfdir}/default/grub |
323 |
|
324 |
# Remove "GNU/Linux" in menu selections |
325 |
sed -i 's/ GNU\/Linux//' %{buildroot}%{_sysconfdir}/grub.d/10_linux |
326 |
|
327 |
cp %{SOURCE9} %{buildroot}%{_datadir}/grub/ |
328 |
|
329 |
%find_lang grub |
330 |
|
331 |
popd |
332 |
|
333 |
%post |
334 |
if [ $1 -eq 2 ]; then |
335 |
touch /boot/grub2/updtrans |
336 |
fi |
337 |
|
338 |
%ifnarch %arm |
339 |
%post efi |
340 |
if [ $1 -eq 2 ]; then |
341 |
touch /boot/grub2/updtrans |
342 |
fi |
343 |
%endif |
344 |
|
345 |
%posttrans common |
346 |
# On update re-install grub2 to where it was installed by drakboot if possible, |
347 |
# otherwise next boot may fail due to mismatched boot code. |
348 |
if [ -f /boot/grub2/updtrans ] && [ -f /boot/grub2/install.sh -a -x /usr/sbin/detectloader ] && [ "$DURING_INSTALL" != "1" ] ; then |
349 |
LOADER=$(/usr/sbin/detectloader) |
350 |
[ "$LOADER" = "GRUB2" ] && /boot/grub2/install.sh ||: |
351 |
rm -f /boot/grub2/updtrans |
352 |
fi |
353 |
# Don't let rpmdrake ask users to shoot themselves in feet! Mga#17263 |
354 |
rm -f /etc/default/grub.rpm* |
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 |
|
366 |
# If installing theme outside installer then update menu |
367 |
if [ "x${DURING_INSTALL}" != "x1" ]; then |
368 |
%{name}-mkconfig -o /boot/%{name}/grub.cfg && rm -f /boot/%{name}/grub.cfg.rpmsave |
369 |
fi |
370 |
fi |
371 |
|
372 |
# Copy system default background at correct aspect ratio to grub2 default theme |
373 |
if [ -h %{_datadir}/mga/backgrounds/default.png ] && [ "$DURING_INSTALL" != "1" ]; then |
374 |
cp -f %{_datadir}/mga/backgrounds/default.png /boot/%{name}/themes/%{name}-mageia-default.png |
375 |
fi |
376 |
|
377 |
# If updating from below 2.02-0.git10101.4 then re-make grub.cfg once. |
378 |
# grub2 dropped ownership of grub.cfg to avoid rpmnew being created. |
379 |
# Remove rpmnew and after new grub.cfg is created remove rpmsave. Mga#17263 |
380 |
%triggerpostun common -- %{name} < 2.02-0.git10101.4, %{name}-efi < 2.02-0.git10101.4 |
381 |
rm -f /boot/%{name}/grub.cfg.rpmnew |
382 |
%{name}-mkconfig -o /boot/%{name}/grub.cfg && rm -f /boot/%{name}/grub.cfg.rpmsave |
383 |
# Take this opportunity to remove some unwanted logs |
384 |
rm -f /var/log/%{name}_preun.log |
385 |
rm -f /var/log/%{name}_post.log |
386 |
rm -f /var/log/%{name}_theme_postun.log |
387 |
|
388 |
%preun |
389 |
# Only if uninstalling |
390 |
if [ $1 -eq 0 ]; then |
391 |
rm -rf /boot/%{name}/%{pc_arch} |
392 |
rm -rf /boot/%{name}/locale |
393 |
fi |
394 |
|
395 |
%ifnarch %arm |
396 |
%preun efi |
397 |
# Only if uninstalling |
398 |
if [ $1 -eq 0 ]; then |
399 |
rm -rf /boot/%{name}/%{efi_arch} |
400 |
rm -rf /boot/%{name}/locale |
401 |
fi |
402 |
%endif |
403 |
|
404 |
%postun mageia-theme |
405 |
# Only if uninstalling theme |
406 |
if [ $1 -eq 0 ]; then |
407 |
# Remove theme from config |
408 |
sed -i '/GRUB_THEME=\/boot\/grub2\/themes\/maggy\/theme.txt/d' %{_sysconfdir}/default/grub |
409 |
fi |
410 |
|
411 |
%ifnarch %arm |
412 |
%files |
413 |
%dir %{_libdir}/grub |
414 |
%dir %{_libdir}/grub/i386-pc |
415 |
%{_libdir}/grub/i386-pc/* |
416 |
%endif |
417 |
|
418 |
%ifnarch %arm |
419 |
%files efi |
420 |
%doc README.efi |
421 |
%dir %{_libdir}/grub |
422 |
%dir %{_libdir}/grub/%{efi_arch} |
423 |
%{_libdir}/grub/%{efi_arch}/* |
424 |
%endif |
425 |
|
426 |
%ifarch %arm |
427 |
%files uboot |
428 |
%dir %{_libdir}/grub |
429 |
%dir %{_libdir}/grub/%{efi_arch} |
430 |
%{_libdir}/grub/%{efi_arch}/* |
431 |
%endif |
432 |
|
433 |
%files common -f grub.lang |
434 |
%doc COPYING NEWS README THANKS TODO README.Mageia |
435 |
%dir /boot/%{name} |
436 |
%dir /boot/%{name}/fonts |
437 |
%dir /boot/%{name}/themes |
438 |
%{_infodir}/* |
439 |
%{_bindir}/%{name}-* |
440 |
%{_bindir}/update-grub |
441 |
%{_bindir}/update-grub2 |
442 |
%{_sbindir}/%{name}-* |
443 |
%{_datarootdir}/bash-completion/completions/grub |
444 |
%{_sysconfdir}/grub.d/README |
445 |
%{_sysconfdir}/grub.d/00_header |
446 |
%{_sysconfdir}/grub.d/01_users |
447 |
%{_sysconfdir}/grub.d/10_linux |
448 |
%{_sysconfdir}/grub.d/20_linux_xen |
449 |
%{_sysconfdir}/grub.d/20_ppc_terminfo |
450 |
%{_sysconfdir}/grub.d/30_os-prober |
451 |
%config(noreplace) %{_sysconfdir}/grub.d/40_custom |
452 |
%config(noreplace) %{_sysconfdir}/grub.d/41_custom |
453 |
%config(noreplace) %{_sysconfdir}/default/grub |
454 |
%{_datadir}/grub |
455 |
%{_datadir}/grub/unicode.pf2 |
456 |
%config(noreplace) /boot/%{name}/custom.cfg |
457 |
%{_mandir}/man1/%{name}-*.1* |
458 |
%{_mandir}/man8/%{name}-*.8* |
459 |
|
460 |
%files mageia-theme |
461 |
/boot/%{name}/themes/* |