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