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

  ViewVC Help
Powered by ViewVC 1.1.30