/[packages]/updates/6/grub2/current/SPECS/grub2.spec
ViewVC logotype

Contents of /updates/6/grub2/current/SPECS/grub2.spec

Parent Directory Parent Directory | Revision Log Revision Log


Revision 808473 - (show annotations) (download)
Sun Jan 4 23:33:49 2015 UTC (9 years, 3 months ago) by barjac
Original Path: cauldron/grub2/current/SPECS/grub2.spec
File size: 16172 byte(s)
BOOT_PARTITION was used before being defined in %%post
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 %define tarver 2.00
15 %define git 9752
16 Name: grub2
17 Version: 2.02
18 Release: %mkrel -c git%{git} 11
19 Summary: Boot-loader with support for Linux, Multiboot and more
20 Group: System/Boot and Init
21 License: GPLv3+ and GPLv2
22 # unicode font is GPLv2
23 URL: http://www.gnu.org/software/grub/
24 Source0: ftp://ftp.gnu.org/gnu/grub/grub-%{tarver}.tar.xz
25 Source1: 90_persistent
26 Source2: grub.default
27 Source3: README.Mageia
28 Source4: README.efi
29 Source5: grub2.filter
30 Source6: grub2.script
31 Source7: theme.txt
32 # pf2 fonts may be regenerated in SOURCES using ./mkfonts
33 Source8: mkfonts
34 Source9: unicode.pf2
35 Source10: MageiaLogo-Bold-16.pf2
36 Source11: MageiaLogo-Bold-20.pf2
37 Source12: MageiaLogo-Bold-28.pf2
38 Source13: MageiaLogo-Regular-20.pf2
39 Source14: Mageia5-grub2-1024x768.png
40 Source15: MageiaLogoFonts-bdf.tar.xz
41 Source16: 93_memtest
42
43 Patch0: grub2-2.00-bzrignore.patch
44 # Upstream git snapshot
45 Patch1: grub2-2.00-mga-git-9752.patch
46 # fix CVE-2014-4607 in bundled minilzo
47 Patch2: grub-2.00-minilzo.patch
48 Patch3: grub2-2.00-mga-grub-mkconfig_lib.in.patch
49 # Fedora patches not upstream
50 #Patch0063: 0063-Add-support-for-linuxefi.patch
51 Patch0443: 0443-Migrate-PPC-from-Yaboot-to-Grub2.patch
52 #Patch0448: 0448-Use-linuxefi-and-initrdefi-where-appropriate.patch
53 Patch0450: 0450-Pass-x-hex-hex-straight-through-unmolested.patch
54 Patch0451: 0451-Fix-crash-on-http.patch
55 Patch0460: 0460-blscfg-add-blscfg-module-to-parse-Boot-Loader-Specif.patch
56 Patch0462: 0462-for-ppc-reset-console-display-attr-when-clear-screen.patch
57 #Patch0468: 0468-Don-t-write-messages-to-the-screen.patch
58 Patch0476: 0476-Use-the-correct-indentation-for-the-term-help-text.patch
59 Patch0479: 0479-Add-support-for-UEFI-operating-systems-returned-by-o.patch
60
61 BuildRequires: flex
62 BuildRequires: bison
63 BuildRequires: ruby
64 BuildRequires: binutils
65 BuildRequires: glibc-static-devel
66 BuildRequires: ncurses-devel
67 BuildRequires: liblzo-devel
68 BuildRequires: pkgconfig(freetype2)
69 BuildRequires: pkgconfig(libusb)
70 BuildRequires: help2man
71 BuildRequires: texinfo
72 BuildRequires: libdevmapper-devel
73 BuildRequires: fuse-devel
74 BuildRequires: autogen
75
76 Conflicts: %{name}-efi
77 Recommends: os-prober >= 1.53
78 Recommends: %{name}-mageia-theme = %{version}-%{release}
79 Provides: bootloader
80 Provides: grub2bootloader
81
82 %description
83 This is the second version of the GRUB (Grand Unified Boot-loader), a highly
84 configurable and customizable boot-loader with modular architecture.
85 It supports a wide range of kernel formats, file systems, computer
86 architectures and hardware devices.
87 It may be safely installed alongside legacy grub.
88 Refer to the README.Mageia file that is part of this package's documentation
89 for more information.
90
91 %package efi
92 Summary: Boot-loader with support for EFI
93 Group: System/Boot and Init
94
95 Conflicts: %{name}
96 Recommends: os-prober >= 1.53
97 Requires(post): efibootmgr
98 Recommends: %{name}-mageia-theme = %{version}-%{release}
99 Provides: bootloader
100 Provides: grub2bootloader
101
102 %description efi
103 This is the second version of the GRUB (Grand Unified Boot-loader), a highly
104 configurable and customizable boot-loader with modular architecture.
105 It supports a wide range of kernel formats, file systems, computer
106 architectures and hardware devices.
107 It may be safely installed alongside legacy grub.
108 Refer to the README.Mageia and README.efi files that are part of this package's
109 documentation for more information.
110
111 %package mageia-theme
112 Summary: Provides a graphical theme with a custom Mageia background for grub2
113 Group: System/Boot and Init
114
115 Requires: grub2bootloader
116 Conflicts: grub2-mageia3-theme-dejavu
117 BuildArch: noarch
118
119 %description mageia-theme
120 This package provides a custom Mageia graphical theme.
121 It is provided as a separate package so it may be easily excluded from
122 minimal installations where a graphical theme is not required.
123
124 %prep
125 %setup -q -n grub-%{tarver}
126
127 %apply_patches
128
129 # README.Mageia
130 cp %{SOURCE3} .
131 # README.efi
132 cp %{SOURCE4} .
133
134 cd ..
135 rm -rf grub-efi-%{tarver}
136 mv grub-%{tarver} grub-efi-%{tarver}
137
138 %setup -q -n grub-%{tarver}
139
140 %apply_patches
141
142 # README.Mageia
143 cp %{SOURCE3} .
144 # README.efi
145 cp %{SOURCE4} .
146
147 %build
148 cd ..
149 pushd grub-%{tarver}
150 ./autogen.sh
151 %configure2_5x TARGET_LDFLAGS=-static \
152 --with-platform=pc \
153 --enable-grub-emu-usb \
154 --disable-werror \
155 --enable-grub-mkfont \
156 --program-transform-name=s,grub,%{name}, \
157 --with-bootdir=/boot \
158 --with-grubdir=/%{name} \
159 CFLAGS=""
160 %make
161 popd
162
163 pushd grub-efi-%{tarver}
164 ./autogen.sh
165 %configure2_5x TARGET_LDFLAGS=-static \
166 --with-platform=efi \
167 %ifarch x86_64
168 --target=x86_64 \
169 %endif
170 --enable-grub-emu-usb \
171 --disable-werror \
172 --enable-grub-mkfont \
173 --program-transform-name=s,grub,%{name}, \
174 --with-bootdir=/boot \
175 --with-grubdir=/%{name} \
176 CFLAGS=""
177 %make
178 popd
179
180 %install
181 cd ..
182 pushd grub-efi-%{tarver}
183 %makeinstall_std
184 popd
185
186 pushd grub-%{tarver}
187 %makeinstall_std
188
189 # (bor) grub.info is harcoded in sources
190 mv %{buildroot}%{_infodir}/grub.info %{buildroot}%{_infodir}/%{name}.info
191
192 # Script that makes part of grub.cfg persist across updates
193 install -m 755 %{SOURCE1} %{buildroot}%{_sysconfdir}/grub.d
194
195 # Memtest
196 install -m 755 %{SOURCE16} %{buildroot}%{_sysconfdir}/grub.d
197
198 # Font
199 install -d %{buildroot}/boot/%{name}/fonts
200 install -D %{SOURCE9} %{buildroot}/boot/%{name}/fonts
201
202 # Theme
203 install -d %{buildroot}/boot/%{name}/themes/maggy
204 install -D %{SOURCE7} %{buildroot}/boot/%{name}/themes/maggy
205 install -D %{SOURCE10} %{buildroot}/boot/%{name}/themes/maggy
206 install -D %{SOURCE11} %{buildroot}/boot/%{name}/themes/maggy
207 install -D %{SOURCE12} %{buildroot}/boot/%{name}/themes/maggy
208 install -D %{SOURCE13} %{buildroot}/boot/%{name}/themes/maggy
209 install -D %{SOURCE14} %{buildroot}/boot/%{name}/themes/maggy
210
211 # Ghost config files
212 install -d %{buildroot}/boot/%{name}
213 touch %{buildroot}/boot/%{name}/grub.cfg
214
215 # Workaround for RHL Bug 817187
216 install -d %{buildroot}%{_datadir}/locale/en/LC_MESSAGES
217 ln -s %{_datadir}/locale/en@quot/LC_MESSAGES/grub.mo %{buildroot}%{_datadir}/locale/en/LC_MESSAGES/grub.mo
218
219 cat > %{buildroot}/boot/%{name}/custom.cfg <<EOF
220 # Set non-graphical text/background colours
221 set menu_color_normal=cyan/blue
222 set menu_color_highlight=white/blue
223
224 # Add any extra custom menu entries in here:
225
226 EOF
227
228 # Provide 'update-grub' and update-grub2 symlink for *buntu exiles ;)
229 cat > %{buildroot}%{_bindir}/update-grub <<EOF
230 #!/bin/sh
231 su --login root -c "/usr/sbin/grub2-mkconfig -o /boot/grub2/grub.cfg"
232
233 EOF
234 chmod +x %{buildroot}%{_bindir}/update-grub
235 ln -s %{_bindir}/update-grub %{buildroot}%{_bindir}/update-grub2
236
237 # Filetriggers
238 install -d %{buildroot}/%{_filetriggers_dir}
239 install -D %{SOURCE5} %{buildroot}/%{_filetriggers_dir}/%{name}.filter
240 install -D %{SOURCE6} %{buildroot}/%{_filetriggers_dir}/%{name}.script
241
242 # Defaults
243 install -m 644 -D %{SOURCE2} %{buildroot}%{_sysconfdir}/default/grub
244
245 # Remove "GNU/Linux" in menu selections
246 sed -i 's/ GNU\/Linux//' %{buildroot}%{_sysconfdir}/grub.d/10_linux
247
248 %find_lang grub
249
250 popd
251
252 %post
253 rm -f /var/log/%{name}_post.log
254
255 # Determine the partition with /boot
256 BOOT_PARTITION=$(df -h /boot |(read; awk '{print $1; exit}'))
257
258 # Generate grub.cfg only on install
259 if [ $1 -eq 1 ]; then
260 %{name}-mkconfig -o /boot/%{name}/grub.cfg
261 # Generate core.img, and install it to filesystem for multiboot
262 %{name}-install --directory=%{_libdir}/grub/%{pc_arch} --grub-setup=/bin/true $BOOT_PARTITION
263 fi
264
265 # make it work with live images
266 if [ "$BOOT_PARTITION" == "overlayfs" ]; then
267 BOOT_PARTITION=$(df -h /mnt/install/boot |(read; awk '{print $1; exit}'))
268 fi
269
270 # On update re-install grub2 to where it was installed by drakboot if possible,
271 # otherwise next boot may fail due to mismatched boot code.
272
273 if [ $1 -eq 2 ]; then
274 # Check for drakboot.conf
275 if [ -e /boot/%{name}/drakboot.conf ]; then
276 # Get install device from drakboot.conf
277 install_dev=$(cat /boot/%{name}/drakboot.conf|grep "boot="|cut -d= -f2)
278 # Check it's not a partition
279 if ! echo $install_dev | grep -q "[0-9]"; then
280 # Only run grub2-install if target has a grub2 MBR
281 if head $install_dev | grep -q "GRUB" && ! head $install_dev | grep -q "stage1.5"; then
282 echo "Installing %{name} to $install_dev" | tee -a /var/log/%{name}_post.log
283 %{name}-install --target=i386-pc $install_dev
284 else
285 echo "MBR not grub2 so skipping grub2-install" | tee -a /var/log/%{name}_post.log
286 fi
287 else
288 # Target is a partition so update /boot/grub2/i386-pc/core.img
289 echo "Partition specified so updating /boot/grub2/i386-pc/core.img" | tee -a /var/log/%{name}_post.log
290 %{name}-install --directory=%{_libdir}/grub/%{pc_arch} --grub-setup=/bin/true $BOOT_PARTITION
291 fi
292 else
293 ## TODO Possible issue with multiboot systems where Mageia is using grub legacy but has grub2 installed
294 ## and another OS is providing grub2 in the MBR and chainloading Mageia. If grub2 was installed manually (outside
295 ## drakboot) then update of grub2 would overwrite MBR, but at least Mageia would boot.
296
297 # If grub2 was manually installed (outside drakboot) and no drakboot.conf exists
298 # then try to determine boot device.
299 # Get array of devices with grub2 bootloader
300 drvarr=($(cat /proc/diskstats| grep -e "^ 8"|tr -s ' '|cut -d' ' -f4,6|rev|grep -v "^0 "|rev|cut -d' ' -f1|grep -v "[0-9]"|sort))
301 grub2arr=()
302 for drv in ${drvarr[@]}; do
303 if head /dev/$drv | grep -q "GRUB" && ! head /dev/$drv | grep -q "stage1.5"; then
304 grub2arr+=($drv)
305 fi
306 done
307 # If there is only one it's *probably* ours so update it
308 if [ ${#grub2arr[@]} -eq 1 ]; then
309 echo "Installing grub2 to /dev/${grub2arr[0]}" | tee -a /var/log/%{name}_post.log
310 %{name}-install --target=i386-pc /dev/${grub2arr[0]}
311 exit 0
312 # If there is more than one then we can't decide so give up with warning
313 elif [ ${#grub2arr[@]} -gt 1 ]; then
314 echo "More than one grub2 MBR so skipping grub2-install" | tee -a /var/log/%{name}_post.log
315 # If there are none then skip
316 elif [ ${#grub2arr[@]} -lt 1 ]; then
317 echo "No grub2 MBR so skipping grub2-install" | tee -a /var/log/%{name}_post.log
318 exit 0
319 fi
320 cat >> /var/log/%{name}_post.log<<EOF
321 ************************** WARNING ***************************
322 Could not install %{name} to a device boot sector as the target was not known.
323 IF %{name} is your current bootloader installed to a MBR, please ensure that
324 %{name}-install is run on the correct boot device BEFORE re-booting.
325 e.g. as root: %{name}-install /dev/sdX
326 To avoid this warning in future please either use MCC -> Boot to set up %{name}
327 or create the file: /boot/%{name}/drakboot.conf containing boot=/dev/sdX
328 where /dev/sdX is the boot device.
329 EOF
330 cat /var/log/%{name}_post.log
331 fi
332 fi
333
334 %post efi
335 rm -f /var/log/%{name}_post.log
336
337 # Determine the partition with /boot
338 BOOT_PARTITION=$(df -h /boot |(read; awk '{print $1; exit}'))
339 # make it work with live images
340 if [ "$BOOT_PARTITION" == "overlayfs" ]; then
341 BOOT_PARTITION=$(df -h /mnt/install/boot |(read; awk '{print $1; exit}'))
342 fi
343
344 # Generate core.img
345 %{name}-install --directory=%{_libdir}/grub/%{efi_arch} --grub-setup=/bin/true $BOOT_PARTITION
346
347 # On update re-install grub2 to where it was installed by drakboot
348 # otherwise next boot may fail due to mismatched boot code.
349 # If grub2 was manually installed (outside drakboot) and no drakboot.conf exists
350 # then print warning.
351
352 # Check for drakboot.conf
353 if [ $1 -eq 2 ]; then
354 if [ -e /boot/%{name}/drakboot.conf ]; then
355 # Get install device from drakboot.conf
356 install_dev=$(cat /boot/%{name}/drakboot.conf|grep "boot="|cut -d= -f2)
357 # Check it's not a partition
358 if ! echo $install_dev | grep -q "[0-9]"; then
359 echo "Installing %{name} to $install_dev" | tee -a /var/log/%{name}_post.log
360 %{name}-install $install_dev
361 fi
362 else
363 cat >> /var/log/%{name}_post.log<<EOF
364 ************************** WARNING ***************************
365 Could not install %{name} to a device as the target was not known.
366 IF %{name} is your current bootloader, please ensure that
367 %{name}-install is run on the boot device BEFORE re-booting.
368 e.g. as root: %{name}-install /dev/sdX
369 To avoid this warning in future please either use MCC -> Boot to set up %{name}
370 or create the file: /boot/%{name}/drakboot.conf containing boot=/dev/sdX
371 where /dev/sdX is the boot device.
372 EOF
373 cat /var/log/%{name}_post.log
374 fi
375 fi
376 # Generate grub.cfg only on install
377 if [ $1 -eq 1 ]; then
378 %{name}-mkconfig -o /boot/%{name}/grub.cfg
379 fi
380
381 %post mageia-theme
382 # Don't install if updating
383 if [ $1 -eq 1 ] ; then
384 # Remove trailing blank lines from /etc/default/grub
385 sed -i -e :a -e '/^\n*$/{$d;N;};/\n$/ba' %{_sysconfdir}/default/grub
386 # Check that /etc/default/grub ends in a linefeed
387 [ "$(tail -n 1 %{_sysconfdir}/default/grub | wc --lines)" = "1" ] || echo >> %{_sysconfdir}/default/grub
388 # Add theme
389 echo "GRUB_THEME=/boot/grub2/themes/maggy/theme.txt" >> %{_sysconfdir}/default/grub
390 fi
391
392 %preun
393 exec > /var/log/%{name}_preun.log 2>&1
394 # Only if uninstalling
395 if [ $1 -eq 0 ]; then
396 rm -rf /boot/%{name}/%{pc_arch}
397 rm -rf /boot/%{name}/locale
398 fi
399
400 %preun efi
401 exec > /var/log/%{name}_preun.log 2>&1
402 # Only if uninstalling
403 if [ $1 -eq 0 ]; then
404 rm -rf /boot/%{name}/%{efi_arch}
405 rm -rf /boot/%{name}/locale
406 fi
407
408 # If updating grub2-efi from version below 2.02-0.git9752.4 then re-generate menu (Mga#13493)
409 # because Fedora patches to use "linuxefi" have now been removed.
410 %triggerpostun efi -- %{name}-efi < 2.02-0.git9752.4
411 %{name}-mkconfig -o /boot/%{name}/grub.cfg
412
413 %postun mageia-theme
414 exec > /var/log/%{name}_theme_postun.log 2>&1
415 # Only if uninstalling theme
416 if [ $1 -eq 0 ]; then
417 # Remove theme from config
418 sed -i '/GRUB_THEME=\/boot\/grub2\/themes\/maggy\/theme.txt/d' %{_sysconfdir}/default/grub
419 fi
420
421 %files -f grub.lang
422 %doc COPYING NEWS README THANKS TODO README.Mageia
423 %{_infodir}/*
424 %dir %{_libdir}/grub
425 %dir %{_libdir}/grub/i386-pc
426 %dir /boot/%{name}
427 %dir /boot/%{name}/fonts
428 %dir /boot/%{name}/themes
429 %{_libdir}/grub/i386-pc/*
430 %{_bindir}/%{name}-*
431 %{_bindir}/update-grub
432 %{_bindir}/update-grub2
433 %{_sbindir}/%{name}-*
434 %{_sysconfdir}/bash_completion.d/grub
435 %{_sysconfdir}/grub.d/README
436 %{_sysconfdir}/grub.d/00_header
437 %{_sysconfdir}/grub.d/10_linux
438 %{_sysconfdir}/grub.d/20_linux_xen
439 %{_sysconfdir}/grub.d/20_ppc_terminfo
440 %{_sysconfdir}/grub.d/93_memtest
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}/grub.cfg
448 %config(noreplace) /boot/%{name}/custom.cfg
449 %{_mandir}/man1/%{name}-*.1*
450 %{_mandir}/man8/%{name}-*.8*
451 %{_filetriggers_dir}/%{name}.filter
452 %{_filetriggers_dir}/%{name}.script
453
454 %files efi -f grub.lang
455 %doc COPYING NEWS README THANKS TODO README.Mageia README.efi
456 %{_infodir}/*
457 %dir %{_libdir}/grub
458 %dir %{_libdir}/grub/%{efi_arch}
459 %dir /boot/%{name}
460 %dir /boot/%{name}/fonts
461 %dir /boot/%{name}/themes
462 %{_libdir}/grub/%{efi_arch}/*
463 %{_bindir}/%{name}-*
464 %{_bindir}/update-grub
465 %{_bindir}/update-grub2
466 %{_sbindir}/%{name}-*
467 %{_sysconfdir}/bash_completion.d/grub
468 %{_sysconfdir}/grub.d/README
469 %{_sysconfdir}/grub.d/00_header
470 %{_sysconfdir}/grub.d/10_linux
471 %{_sysconfdir}/grub.d/20_linux_xen
472 %{_sysconfdir}/grub.d/20_ppc_terminfo
473 %{_sysconfdir}/grub.d/93_memtest
474 %{_sysconfdir}/grub.d/30_os-prober
475 %{_sysconfdir}/grub.d/90_persistent
476 %config(noreplace) %{_sysconfdir}/grub.d/40_custom
477 %config(noreplace) %{_sysconfdir}/grub.d/41_custom
478 %config(noreplace) %{_sysconfdir}/default/grub
479 %{_datadir}/grub
480 %config(noreplace) /boot/%{name}/grub.cfg
481 %config(noreplace) /boot/%{name}/custom.cfg
482 %{_mandir}/man1/%{name}-*.1*
483 %{_mandir}/man8/%{name}-*.8*
484 %{_filetriggers_dir}/%{name}.filter
485 %{_filetriggers_dir}/%{name}.script
486
487 %files mageia-theme
488 /boot/%{name}/fonts/unicode.pf2
489 %dir /boot/%{name}/themes/maggy
490 /boot/%{name}/themes/maggy/*

  ViewVC Help
Powered by ViewVC 1.1.30