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 10270 |
23 |
%define rel 6 |
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 |
Source1: 90_persistent |
36 |
Source2: grub.default |
37 |
Source3: README.Mageia |
38 |
Source4: README.efi |
39 |
Source6: gitignore |
40 |
Source7: grub.patches |
41 |
# pf2 fonts may be regenerated in SOURCES using ./mkfonts |
42 |
Source8: mkfonts |
43 |
Source9: unicode.pf2 |
44 |
Source10: MageiaLogo-Bold-16.pf2 |
45 |
Source11: MageiaLogo-Bold-20.pf2 |
46 |
Source12: MageiaLogo-Bold-28.pf2 |
47 |
Source13: MageiaLogo-Regular-20.pf2 |
48 |
Source14: Mageia5-grub2-1024x768.png |
49 |
Source15: MageiaLogoFonts-bdf.tar.xz |
50 |
Source20: theme.txt |
51 |
|
52 |
# |
53 |
# Fedora patches: |
54 |
# |
55 |
# generate with do-rebase |
56 |
#include %%{SOURCE7} |
57 |
# (tv) :r SOURCES/grub.patches |
58 |
%{expand:%(while read line; do echo $line; done < %{SOURCE7})} |
59 |
|
60 |
# And these are: |
61 |
# git checkout debuginfo |
62 |
# git format-patch fedora-23.. |
63 |
Patch10001: 10001-Put-the-correct-.file-directives-in-our-.S-files.patch |
64 |
Patch10002: 10002-Make-it-possible-to-enabled-build-id-sha1.patch |
65 |
#Patch10003: 10003-Don-t-tell-the-compiler-to-do-annoying-things-with-.patch |
66 |
Patch10004: 10004-Add-grub_qdprintf-grub_dprintf-without-the-file-lin.patch |
67 |
Patch10005: 10005-Make-a-gdb-dprintf-that-tells-us-load-addresses.patch |
68 |
#Patch10006: 10006-Try-it-in-gentpl-again.patch |
69 |
|
70 |
# |
71 |
# Mga patches: |
72 |
# |
73 |
Patch20001: grub2-2.00-mga-add_failsafe-10_linux.in.patch |
74 |
|
75 |
BuildRequires: autoconf |
76 |
BuildRequires: autogen |
77 |
BuildRequires: automake |
78 |
BuildRequires: binutils |
79 |
BuildRequires: bison |
80 |
BuildRequires: bzip2-devel |
81 |
BuildRequires: device-mapper-devel |
82 |
BuildRequires: flex |
83 |
BuildRequires: freetype2-devel |
84 |
BuildRequires: freetype-devel |
85 |
BuildRequires: freetype-devel |
86 |
BuildRequires: fuse-devel |
87 |
BuildRequires: gettext-devel |
88 |
BuildRequires: git |
89 |
BuildRequires: glibc-static-devel |
90 |
BuildRequires: help2man |
91 |
BuildRequires: liblzo-devel |
92 |
BuildRequires: libusb-devel |
93 |
BuildRequires: ncurses-devel |
94 |
BuildRequires: python |
95 |
BuildRequires: rpm-devel |
96 |
BuildRequires: ruby |
97 |
BuildRequires: texinfo |
98 |
|
99 |
Conflicts: %{name}-efi |
100 |
Provides: bootloader |
101 |
Provides: grub2bootloader = %{version}-%{release} |
102 |
Requires: %{name}-common = %{version}-%{release} |
103 |
|
104 |
%description |
105 |
This is the second version of the GRUB (Grand Unified Boot-loader), a highly |
106 |
configurable and customizable boot-loader with modular architecture. |
107 |
It supports a wide range of kernel formats, file systems, computer |
108 |
architectures and hardware devices. |
109 |
Refer to the README.Mageia file that is part of this package's documentation |
110 |
for more information. |
111 |
|
112 |
%ifnarch %arm |
113 |
%package efi |
114 |
Summary: Boot-loader with support for EFI |
115 |
Group: System/Boot and Init |
116 |
|
117 |
Conflicts: %{name} |
118 |
Requires(post): efibootmgr |
119 |
Provides: bootloader |
120 |
Provides: grub2bootloader = %{version}-%{release} |
121 |
Requires: %{name}-common = %{version}-%{release} |
122 |
|
123 |
%description efi |
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 |
************************** WARNING ************************ |
129 |
Do not attempt to install this package on a system which is not |
130 |
already using UEFI mode to boot. You cannot switch to UEFI mode by installing |
131 |
this package, the system must be installed in UEFI mode to use it, when it |
132 |
will be installed by default. |
133 |
%endif |
134 |
|
135 |
%ifarch %arm |
136 |
%package uboot |
137 |
Summary: Boot-loader with support for UBOOT |
138 |
Group: System/Boot and Init |
139 |
|
140 |
Provides: bootloader |
141 |
Provides: grub2bootloader = %{version}-%{release} |
142 |
Requires: %{name}-common = %{version}-%{release} |
143 |
|
144 |
%description uboot |
145 |
configurable and customizable boot-loader with modular architecture. |
146 |
It supports a wide range of kernel formats, file systems, computer |
147 |
architectures and hardware devices. |
148 |
%endif |
149 |
|
150 |
%package common |
151 |
Summary: Provides files common to both grub2 and grub2-efi |
152 |
Group: System/Boot and Init |
153 |
Conflicts: memtest86+ < 5.01-7 |
154 |
Conflicts: %{name} < 2.02-0.git9752.19.mga5 |
155 |
Conflicts: %{name}-efi < 2.02-0.git9752.19.mga5 |
156 |
#Recommends: %%{name}-mageia-theme = %%{version}-%%{release} |
157 |
Recommends: os-prober >= 1.53 |
158 |
Recommends: xorriso |
159 |
Recommends: memtest86+ >= 5.01-7 |
160 |
Requires: grub2bootloader = %{version}-%{release} |
161 |
|
162 |
%description common |
163 |
Common files used by both grub2 and grub2-efi. |
164 |
|
165 |
%package mageia-theme |
166 |
Summary: Provides a graphical theme with a custom Mageia background for grub2 |
167 |
Group: System/Boot and Init |
168 |
|
169 |
Requires: grub2bootloader = %{version}-%{release} |
170 |
Conflicts: grub2-mageia3-theme-dejavu |
171 |
BuildArch: noarch |
172 |
|
173 |
%description mageia-theme |
174 |
This package provides a custom Mageia graphical theme. |
175 |
It is provided as a separate package so it may be easily excluded from |
176 |
minimal installations where a graphical theme is not required. |
177 |
|
178 |
%prep |
179 |
%setup -q -n grub-%{tarversion} |
180 |
|
181 |
cp %{SOURCE6} .gitignore |
182 |
git init |
183 |
echo '![[:digit:]][[:digit:]]_*.in' > util/grub.d/.gitignore |
184 |
echo '!*.[[:digit:]]' > util/.gitignore |
185 |
git config user.email "%{name}-owner@fedoraproject.org" |
186 |
git config user.name "Fedora Ninjas" |
187 |
git config gc.auto 0 |
188 |
git add . |
189 |
git commit -a -q -m "%{tarversion} baseline." |
190 |
git am %{patches} </dev/null |
191 |
git config --unset user.email |
192 |
git config --unset user.name |
193 |
|
194 |
# README.Mageia |
195 |
cp %{SOURCE3} . |
196 |
|
197 |
%ifnarch %arm |
198 |
# README.efi |
199 |
cp %{SOURCE4} . |
200 |
|
201 |
cd .. |
202 |
rm -rf grub-efi-%{tarversion} |
203 |
mv grub-%{tarversion} grub-efi-%{tarversion} |
204 |
%endif |
205 |
|
206 |
%setup -q -n grub-%{tarversion} |
207 |
|
208 |
cp %{SOURCE6} .gitignore |
209 |
git init |
210 |
echo '![[:digit:]][[:digit:]]_*.in' > util/grub.d/.gitignore |
211 |
echo '!*.[[:digit:]]' > util/.gitignore |
212 |
git config user.email "%{name}-owner@fedoraproject.org" |
213 |
git config user.name "Fedora Ninjas" |
214 |
git config gc.auto 0 |
215 |
git add . |
216 |
git commit -a -q -m "%{tarversion} baseline." |
217 |
git am %{patches} </dev/null |
218 |
git config --unset user.email |
219 |
git config --unset user.name |
220 |
find . -name "*.0???" -delete |
221 |
|
222 |
# README.Mageia |
223 |
cp %{SOURCE3} . |
224 |
# README.efi |
225 |
cp %{SOURCE4} . |
226 |
|
227 |
%build |
228 |
cd .. |
229 |
pushd grub-%{tarversion} |
230 |
./autogen.sh |
231 |
%configure2_5x TARGET_LDFLAGS=-static \ |
232 |
%ifarch %arm |
233 |
--with-platform=uboot \ |
234 |
%else |
235 |
--with-platform=pc \ |
236 |
%endif |
237 |
--enable-grub-emu-usb \ |
238 |
--disable-werror \ |
239 |
--enable-grub-mkfont \ |
240 |
--program-transform-name=s,grub,%{name}, \ |
241 |
--with-bootdir=/boot \ |
242 |
--with-grubdir=/%{name} \ |
243 |
CFLAGS="" |
244 |
%make |
245 |
popd |
246 |
|
247 |
%ifnarch %arm |
248 |
pushd grub-efi-%{tarversion} |
249 |
./autogen.sh |
250 |
%configure2_5x TARGET_LDFLAGS=-static \ |
251 |
--with-platform=efi \ |
252 |
%ifarch x86_64 |
253 |
--target=x86_64 \ |
254 |
%endif |
255 |
--enable-grub-emu-usb \ |
256 |
--disable-werror \ |
257 |
--enable-grub-mkfont \ |
258 |
--program-transform-name=s,grub,%{name}, \ |
259 |
--with-bootdir=/boot \ |
260 |
--with-grubdir=/%{name} \ |
261 |
CFLAGS="" |
262 |
%make |
263 |
popd |
264 |
%endif |
265 |
|
266 |
%install |
267 |
cd .. |
268 |
%ifnarch %arm |
269 |
pushd grub-efi-%{tarversion} |
270 |
%makeinstall_std |
271 |
popd |
272 |
%endif |
273 |
|
274 |
pushd grub-%{tarversion} |
275 |
%makeinstall_std |
276 |
|
277 |
# (bor) grub.info is harcoded in sources |
278 |
mv %{buildroot}%{_infodir}/grub.info %{buildroot}%{_infodir}/%{name}.info |
279 |
|
280 |
# Script that makes part of grub.cfg persist across updates |
281 |
install -m 755 %{SOURCE1} %{buildroot}%{_sysconfdir}/grub.d |
282 |
|
283 |
# Font |
284 |
install -d %{buildroot}/boot/%{name}/fonts |
285 |
install -D %{SOURCE9} %{buildroot}/boot/%{name}/fonts |
286 |
|
287 |
# Theme |
288 |
install -d %{buildroot}/boot/%{name}/themes/maggy |
289 |
install -D %{SOURCE20} %{buildroot}/boot/%{name}/themes/maggy |
290 |
install -D %{SOURCE10} %{buildroot}/boot/%{name}/themes/maggy |
291 |
install -D %{SOURCE11} %{buildroot}/boot/%{name}/themes/maggy |
292 |
install -D %{SOURCE12} %{buildroot}/boot/%{name}/themes/maggy |
293 |
install -D %{SOURCE13} %{buildroot}/boot/%{name}/themes/maggy |
294 |
install -D %{SOURCE14} %{buildroot}/boot/%{name}/themes/maggy |
295 |
|
296 |
# Ghost config files |
297 |
install -d %{buildroot}/boot/%{name} |
298 |
|
299 |
# Workaround for RHL Bug 817187 |
300 |
install -d %{buildroot}%{_datadir}/locale/en/LC_MESSAGES |
301 |
ln -s %{_datadir}/locale/en@quot/LC_MESSAGES/grub.mo %{buildroot}%{_datadir}/locale/en/LC_MESSAGES/grub.mo |
302 |
|
303 |
cat > %{buildroot}/boot/%{name}/custom.cfg <<EOF |
304 |
# Set non-graphical text/background colours |
305 |
set menu_color_normal=cyan/blue |
306 |
set menu_color_highlight=white/blue |
307 |
|
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 |
%find_lang grub |
328 |
|
329 |
popd |
330 |
|
331 |
%post |
332 |
# On update re-install grub2 to where it was installed by drakboot if possible, |
333 |
# otherwise next boot may fail due to mismatched boot code. |
334 |
|
335 |
if [ $1 -eq 2 ]; then |
336 |
if [ -f /boot/grub2/install.sh -a -x /usr/sbin/detectloader ]; then |
337 |
LOADER=$(/usr/sbin/detectloader) |
338 |
[ "$LOADER" = "GRUB2" ] && /boot/grub2/install.sh ||: |
339 |
fi |
340 |
rm -f /etc/default/grub.rpm* |
341 |
fi |
342 |
|
343 |
%ifnarch %arm |
344 |
%post efi |
345 |
# On update re-install grub2 to where it was installed by drakboot if possible, |
346 |
# otherwise next boot may fail due to mismatched boot code. |
347 |
|
348 |
if [ $1 -eq 2 ]; then |
349 |
if [ -f /boot/grub2/install.sh -a -x /usr/sbin/detectloader ]; then |
350 |
LOADER=$(/usr/sbin/detectloader) |
351 |
[ "$LOADER" = "GRUB2" ] && /boot/grub2/install.sh ||: |
352 |
fi |
353 |
rm -f /etc/default/grub.rpm* |
354 |
fi |
355 |
%endif |
356 |
|
357 |
%post mageia-theme |
358 |
# Don't install if updating |
359 |
if [ $1 -eq 1 ] ; then |
360 |
# Remove trailing blank lines from /etc/default/grub |
361 |
sed -i -e :a -e '/^\n*$/{$d;N;};/\n$/ba' %{_sysconfdir}/default/grub |
362 |
# Check that /etc/default/grub ends in a linefeed |
363 |
[ "$(tail -n 1 %{_sysconfdir}/default/grub | wc --lines)" = "1" ] || echo >> %{_sysconfdir}/default/grub |
364 |
# Add theme |
365 |
echo "GRUB_THEME=/boot/grub2/themes/maggy/theme.txt" >> %{_sysconfdir}/default/grub |
366 |
fi |
367 |
|
368 |
# If updating from below 2.02-0.git10101.4 then re-make grub.cfg once. |
369 |
# grub2 dropped ownership of grub.cfg to avoid rpmnew being created. |
370 |
# Remove rpmnew and after new grub.cfg is created remove rpmsave. |
371 |
%triggerpostun common -- %{name} < 2.02-0.git10101.4, %{name}-efi < 2.02-0.git10101.4 |
372 |
rm -f /boot/%{name}/grub.cfg.rpmnew |
373 |
%{name}-mkconfig -o /boot/%{name}/grub.cfg && rm -f /boot/%{name}/grub.cfg.rpmsave |
374 |
# Take this opportunity to remove some unwanted logs |
375 |
rm -f /var/log/%{name}_preun.log |
376 |
rm -f /var/log/%{name}_post.log |
377 |
rm -f /var/log/%{name}_theme_postun.log |
378 |
|
379 |
%preun |
380 |
# Only if uninstalling |
381 |
if [ $1 -eq 0 ]; then |
382 |
rm -rf /boot/%{name}/%{pc_arch} |
383 |
rm -rf /boot/%{name}/locale |
384 |
fi |
385 |
|
386 |
%ifnarch %arm |
387 |
%preun efi |
388 |
# Only if uninstalling |
389 |
if [ $1 -eq 0 ]; then |
390 |
rm -rf /boot/%{name}/%{efi_arch} |
391 |
rm -rf /boot/%{name}/locale |
392 |
fi |
393 |
%endif |
394 |
|
395 |
%postun mageia-theme |
396 |
# Only if uninstalling theme |
397 |
if [ $1 -eq 0 ]; then |
398 |
# Remove theme from config |
399 |
sed -i '/GRUB_THEME=\/boot\/grub2\/themes\/maggy\/theme.txt/d' %{_sysconfdir}/default/grub |
400 |
fi |
401 |
|
402 |
%ifnarch %arm |
403 |
%files |
404 |
%dir %{_libdir}/grub |
405 |
%dir %{_libdir}/grub/i386-pc |
406 |
%{_libdir}/grub/i386-pc/* |
407 |
%endif |
408 |
|
409 |
%ifnarch %arm |
410 |
%files efi |
411 |
%doc README.efi |
412 |
%dir %{_libdir}/grub |
413 |
%dir %{_libdir}/grub/%{efi_arch} |
414 |
%{_libdir}/grub/%{efi_arch}/* |
415 |
%endif |
416 |
|
417 |
%ifarch %arm |
418 |
%files uboot |
419 |
%dir %{_libdir}/grub |
420 |
%dir %{_libdir}/grub/%{efi_arch} |
421 |
%{_libdir}/grub/%{efi_arch}/* |
422 |
%endif |
423 |
|
424 |
%files common -f grub.lang |
425 |
%doc COPYING NEWS README THANKS TODO README.Mageia |
426 |
%dir /boot/%{name} |
427 |
%dir /boot/%{name}/fonts |
428 |
%dir /boot/%{name}/themes |
429 |
%{_infodir}/* |
430 |
%{_bindir}/%{name}-* |
431 |
%{_bindir}/update-grub |
432 |
%{_bindir}/update-grub2 |
433 |
%{_sbindir}/%{name}-* |
434 |
%{_datarootdir}/bash-completion/completions/grub |
435 |
%{_sysconfdir}/grub.d/README |
436 |
%{_sysconfdir}/grub.d/00_header |
437 |
%{_sysconfdir}/grub.d/01_users |
438 |
%{_sysconfdir}/grub.d/10_linux |
439 |
%{_sysconfdir}/grub.d/20_linux_xen |
440 |
%{_sysconfdir}/grub.d/20_ppc_terminfo |
441 |
%{_sysconfdir}/grub.d/30_os-prober |
442 |
%{_sysconfdir}/grub.d/90_persistent |
443 |
%config(noreplace) %{_sysconfdir}/grub.d/40_custom |
444 |
%config(noreplace) %{_sysconfdir}/grub.d/41_custom |
445 |
%config(noreplace) %{_sysconfdir}/default/grub |
446 |
%{_datadir}/grub |
447 |
%config(noreplace) /boot/%{name}/custom.cfg |
448 |
%{_mandir}/man1/%{name}-*.1* |
449 |
%{_mandir}/man8/%{name}-*.8* |
450 |
|
451 |
%files mageia-theme |
452 |
/boot/%{name}/fonts/unicode.pf2 |
453 |
%dir /boot/%{name}/themes/maggy |
454 |
/boot/%{name}/themes/maggy/* |