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