/[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 803582 - (show annotations) (download)
Tue Dec 16 14:00:41 2014 UTC (9 years, 4 months ago) by barjac
Original Path: cauldron/grub2/current/SPECS/grub2.spec
File size: 16171 byte(s)
update theme for Mageia 5
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} 10
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 # Generate grub.cfg only on install
256 if [ $1 -eq 1 ]; then
257 %{name}-mkconfig -o /boot/%{name}/grub.cfg
258 # Generate core.img, and install it to filesystem for multiboot
259 %{name}-install --directory=%{_libdir}/grub/%{pc_arch} --grub-setup=/bin/true $BOOT_PARTITION
260 fi
261
262 # Determine the partition with /boot
263 BOOT_PARTITION=$(df -h /boot |(read; awk '{print $1; exit}'))
264 # make it work with live images
265 if [ "$BOOT_PARTITION" == "overlayfs" ]; then
266 BOOT_PARTITION=$(df -h /mnt/install/boot |(read; awk '{print $1; exit}'))
267 fi
268
269 # On update re-install grub2 to where it was installed by drakboot if possible,
270 # otherwise next boot may fail due to mismatched boot code.
271
272 if [ $1 -eq 2 ]; then
273 # Check for drakboot.conf
274 if [ -e /boot/%{name}/drakboot.conf ]; then
275 # Get install device from drakboot.conf
276 install_dev=$(cat /boot/%{name}/drakboot.conf|grep "boot="|cut -d= -f2)
277 # Check it's not a partition
278 if ! echo $install_dev | grep -q "[0-9]"; then
279 # Only run grub2-install if target has a grub2 MBR
280 if head $install_dev | grep -q "GRUB" && ! head $install_dev | grep -q "stage1.5"; then
281 echo "Installing %{name} to $install_dev" | tee -a /var/log/%{name}_post.log
282 %{name}-install --target=i386-pc $install_dev
283 else
284 echo "MBR not grub2 so skipping grub2-install" | tee -a /var/log/%{name}_post.log
285 fi
286 else
287 # Target is a partition so update /boot/grub2/i386-pc/core.img
288 echo "Partition specified so updating /boot/grub2/i386-pc/core.img" | tee -a /var/log/%{name}_post.log
289 %{name}-install --directory=%{_libdir}/grub/%{pc_arch} --grub-setup=/bin/true $BOOT_PARTITION
290 fi
291 else
292 ## TODO Possible issue with multiboot systems where Mageia is using grub legacy but has grub2 installed
293 ## and another OS is providing grub2 in the MBR and chainloading Mageia. If grub2 was installed manually (outside
294 ## drakboot) then update of grub2 would overwrite MBR, but at least Mageia would boot.
295
296 # If grub2 was manually installed (outside drakboot) and no drakboot.conf exists
297 # then try to determine boot device.
298 # Get array of devices with grub2 bootloader
299 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))
300 grub2arr=()
301 for drv in ${drvarr[@]}; do
302 if head /dev/$drv | grep -q "GRUB" && ! head /dev/$drv | grep -q "stage1.5"; then
303 grub2arr+=($drv)
304 fi
305 done
306 # If there is only one it's *probably* ours so update it
307 if [ ${#grub2arr[@]} -eq 1 ]; then
308 echo "Installing grub2 to /dev/${grub2arr[0]}" | tee -a /var/log/%{name}_post.log
309 %{name}-install --target=i386-pc /dev/${grub2arr[0]}
310 exit 0
311 # If there is more than one then we can't decide so give up with warning
312 elif [ ${#grub2arr[@]} -gt 1 ]; then
313 echo "More than one grub2 MBR so skipping grub2-install" | tee -a /var/log/%{name}_post.log
314 # If there are none then skip
315 elif [ ${#grub2arr[@]} -lt 1 ]; then
316 echo "No grub2 MBR so skipping grub2-install" | tee -a /var/log/%{name}_post.log
317 exit 0
318 fi
319 cat >> /var/log/%{name}_post.log<<EOF
320 ************************** WARNING ***************************
321 Could not install %{name} to a device boot sector as the target was not known.
322 IF %{name} is your current bootloader installed to a MBR, please ensure that
323 %{name}-install is run on the correct boot device BEFORE re-booting.
324 e.g. as root: %{name}-install /dev/sdX
325 To avoid this warning in future please either use MCC -> Boot to set up %{name}
326 or create the file: /boot/%{name}/drakboot.conf containing boot=/dev/sdX
327 where /dev/sdX is the boot device.
328 EOF
329 cat /var/log/%{name}_post.log
330 fi
331 fi
332
333 %post efi
334 rm -f /var/log/%{name}_post.log
335
336 # Determine the partition with /boot
337 BOOT_PARTITION=$(df -h /boot |(read; awk '{print $1; exit}'))
338 # make it work with live images
339 if [ "$BOOT_PARTITION" == "overlayfs" ]; then
340 BOOT_PARTITION=$(df -h /mnt/install/boot |(read; awk '{print $1; exit}'))
341 fi
342
343 # Generate core.img
344 %{name}-install --directory=%{_libdir}/grub/%{efi_arch} --grub-setup=/bin/true $BOOT_PARTITION
345
346 # On update re-install grub2 to where it was installed by drakboot
347 # otherwise next boot may fail due to mismatched boot code.
348 # If grub2 was manually installed (outside drakboot) and no drakboot.conf exists
349 # then print warning.
350
351 # Check for drakboot.conf
352 if [ $1 -eq 2 ]; then
353 if [ -e /boot/%{name}/drakboot.conf ]; then
354 # Get install device from drakboot.conf
355 install_dev=$(cat /boot/%{name}/drakboot.conf|grep "boot="|cut -d= -f2)
356 # Check it's not a partition
357 if ! echo $install_dev | grep -q "[0-9]"; then
358 echo "Installing %{name} to $install_dev" | tee -a /var/log/%{name}_post.log
359 %{name}-install $install_dev
360 fi
361 else
362 cat >> /var/log/%{name}_post.log<<EOF
363 ************************** WARNING ***************************
364 Could not install %{name} to a device as the target was not known.
365 IF %{name} is your current bootloader, please ensure that
366 %{name}-install is run on the boot device BEFORE re-booting.
367 e.g. as root: %{name}-install /dev/sdX
368 To avoid this warning in future please either use MCC -> Boot to set up %{name}
369 or create the file: /boot/%{name}/drakboot.conf containing boot=/dev/sdX
370 where /dev/sdX is the boot device.
371 EOF
372 cat /var/log/%{name}_post.log
373 fi
374 fi
375 # Generate grub.cfg only on install
376 if [ $1 -eq 1 ]; then
377 %{name}-mkconfig -o /boot/%{name}/grub.cfg
378 fi
379
380 %post mageia-theme
381 # Don't install if updating
382 if [ $1 -eq 1 ] ; then
383 # Remove trailing blank lines from /etc/default/grub
384 sed -i -e :a -e '/^\n*$/{$d;N;};/\n$/ba' %{_sysconfdir}/default/grub
385 # Check that /etc/default/grub ends in a linefeed
386 [ "$(tail -n 1 %{_sysconfdir}/default/grub | wc --lines)" = "1" ] || echo >> %{_sysconfdir}/default/grub
387 # Add theme
388 echo "GRUB_THEME=/boot/grub2/themes/maggy/theme.txt" >> %{_sysconfdir}/default/grub
389 fi
390
391 %preun
392 exec > /var/log/%{name}_preun.log 2>&1
393 # Only if uninstalling
394 if [ $1 -eq 0 ]; then
395 rm -rf /boot/%{name}/%{pc_arch}
396 rm -rf /boot/%{name}/locale
397 fi
398
399 %preun efi
400 exec > /var/log/%{name}_preun.log 2>&1
401 # Only if uninstalling
402 if [ $1 -eq 0 ]; then
403 rm -rf /boot/%{name}/%{efi_arch}
404 rm -rf /boot/%{name}/locale
405 fi
406
407 # If updating grub2-efi from version below 2.02-0.git9752.4 then re-generate menu (Mga#13493)
408 # because Fedora patches to use "linuxefi" have now been removed.
409 %triggerpostun efi -- %{name}-efi < 2.02-0.git9752.4
410 %{name}-mkconfig -o /boot/%{name}/grub.cfg
411
412 %postun mageia-theme
413 exec > /var/log/%{name}_theme_postun.log 2>&1
414 # Only if uninstalling theme
415 if [ $1 -eq 0 ]; then
416 # Remove theme from config
417 sed -i '/GRUB_THEME=\/boot\/grub2\/themes\/maggy\/theme.txt/d' %{_sysconfdir}/default/grub
418 fi
419
420 %files -f grub.lang
421 %doc COPYING NEWS README THANKS TODO README.Mageia
422 %{_infodir}/*
423 %dir %{_libdir}/grub
424 %dir %{_libdir}/grub/i386-pc
425 %dir /boot/%{name}
426 %dir /boot/%{name}/fonts
427 %dir /boot/%{name}/themes
428 %{_libdir}/grub/i386-pc/*
429 %{_bindir}/%{name}-*
430 %{_bindir}/update-grub
431 %{_bindir}/update-grub2
432 %{_sbindir}/%{name}-*
433 %{_sysconfdir}/bash_completion.d/grub
434 %{_sysconfdir}/grub.d/README
435 %{_sysconfdir}/grub.d/00_header
436 %{_sysconfdir}/grub.d/10_linux
437 %{_sysconfdir}/grub.d/20_linux_xen
438 %{_sysconfdir}/grub.d/20_ppc_terminfo
439 %{_sysconfdir}/grub.d/93_memtest
440 %{_sysconfdir}/grub.d/30_os-prober
441 %{_sysconfdir}/grub.d/90_persistent
442 %config(noreplace) %{_sysconfdir}/grub.d/40_custom
443 %config(noreplace) %{_sysconfdir}/grub.d/41_custom
444 %config(noreplace) %{_sysconfdir}/default/grub
445 %{_datadir}/grub
446 %config(noreplace) /boot/%{name}/grub.cfg
447 %config(noreplace) /boot/%{name}/custom.cfg
448 %{_mandir}/man1/%{name}-*.1*
449 %{_mandir}/man8/%{name}-*.8*
450 %{_filetriggers_dir}/%{name}.filter
451 %{_filetriggers_dir}/%{name}.script
452
453 %files efi -f grub.lang
454 %doc COPYING NEWS README THANKS TODO README.Mageia README.efi
455 %{_infodir}/*
456 %dir %{_libdir}/grub
457 %dir %{_libdir}/grub/%{efi_arch}
458 %dir /boot/%{name}
459 %dir /boot/%{name}/fonts
460 %dir /boot/%{name}/themes
461 %{_libdir}/grub/%{efi_arch}/*
462 %{_bindir}/%{name}-*
463 %{_bindir}/update-grub
464 %{_bindir}/update-grub2
465 %{_sbindir}/%{name}-*
466 %{_sysconfdir}/bash_completion.d/grub
467 %{_sysconfdir}/grub.d/README
468 %{_sysconfdir}/grub.d/00_header
469 %{_sysconfdir}/grub.d/10_linux
470 %{_sysconfdir}/grub.d/20_linux_xen
471 %{_sysconfdir}/grub.d/20_ppc_terminfo
472 %{_sysconfdir}/grub.d/93_memtest
473 %{_sysconfdir}/grub.d/30_os-prober
474 %{_sysconfdir}/grub.d/90_persistent
475 %config(noreplace) %{_sysconfdir}/grub.d/40_custom
476 %config(noreplace) %{_sysconfdir}/grub.d/41_custom
477 %config(noreplace) %{_sysconfdir}/default/grub
478 %{_datadir}/grub
479 %config(noreplace) /boot/%{name}/grub.cfg
480 %config(noreplace) /boot/%{name}/custom.cfg
481 %{_mandir}/man1/%{name}-*.1*
482 %{_mandir}/man8/%{name}-*.8*
483 %{_filetriggers_dir}/%{name}.filter
484 %{_filetriggers_dir}/%{name}.script
485
486 %files mageia-theme
487 /boot/%{name}/fonts/unicode.pf2
488 %dir /boot/%{name}/themes/maggy
489 /boot/%{name}/themes/maggy/*

  ViewVC Help
Powered by ViewVC 1.1.30