%define Werror_cflags %nil # Modules always contain just 32-bit code %define _libdir %{_exec_prefix}/lib %ifarch x86_64 # 64bit intel machines use 32bit boot loader # (We cannot just redefine _target_cpu, as we'd get i386.rpm packages) %global _target_platform i386-%{_vendor}-%{_target_os}%{?_gnu} %global efi_arch x86_64-efi %else %global efi_arch i386-efi %endif %global pc_arch i386-pc %define tarver 2.00 %define git 9752 Name: grub2 Version: 2.02 Release: %mkrel -c git%{git} 13 Summary: Boot-loader with support for Linux, Multiboot and more Group: System/Boot and Init License: GPLv3+ and GPLv2 # unicode font is GPLv2 URL: http://www.gnu.org/software/grub/ Source0: ftp://ftp.gnu.org/gnu/grub/grub-%{tarver}.tar.xz Source1: 90_persistent Source2: grub.default Source3: README.Mageia Source4: README.efi Source5: grub2.filter Source6: grub2.script Source7: theme.txt # pf2 fonts may be regenerated in SOURCES using ./mkfonts Source8: mkfonts Source9: unicode.pf2 Source10: MageiaLogo-Bold-16.pf2 Source11: MageiaLogo-Bold-20.pf2 Source12: MageiaLogo-Bold-28.pf2 Source13: MageiaLogo-Regular-20.pf2 Source14: Mageia5-grub2-1024x768.png Source15: MageiaLogoFonts-bdf.tar.xz Source16: 93_memtest Patch0: grub2-2.00-bzrignore.patch # Upstream git snapshot Patch1: grub2-2.00-mga-git-9752.patch # fix CVE-2014-4607 in bundled minilzo Patch2: grub-2.00-minilzo.patch Patch3: grub2-2.00-mga-grub-mkconfig_lib.in.patch # Fedora patches not upstream #Patch0063: 0063-Add-support-for-linuxefi.patch Patch0443: 0443-Migrate-PPC-from-Yaboot-to-Grub2.patch #Patch0448: 0448-Use-linuxefi-and-initrdefi-where-appropriate.patch Patch0450: 0450-Pass-x-hex-hex-straight-through-unmolested.patch Patch0451: 0451-Fix-crash-on-http.patch Patch0460: 0460-blscfg-add-blscfg-module-to-parse-Boot-Loader-Specif.patch Patch0462: 0462-for-ppc-reset-console-display-attr-when-clear-screen.patch #Patch0468: 0468-Don-t-write-messages-to-the-screen.patch Patch0476: 0476-Use-the-correct-indentation-for-the-term-help-text.patch Patch0479: 0479-Add-support-for-UEFI-operating-systems-returned-by-o.patch BuildRequires: flex BuildRequires: bison BuildRequires: ruby BuildRequires: binutils BuildRequires: glibc-static-devel BuildRequires: ncurses-devel BuildRequires: liblzo-devel BuildRequires: pkgconfig(freetype2) BuildRequires: pkgconfig(libusb) BuildRequires: help2man BuildRequires: texinfo BuildRequires: libdevmapper-devel BuildRequires: fuse-devel BuildRequires: autogen Conflicts: %{name}-efi Recommends: os-prober >= 1.53 Recommends: %{name}-mageia-theme = %{version}-%{release} Provides: bootloader Provides: grub2bootloader Requires: xorriso %description This is the second version of the GRUB (Grand Unified Boot-loader), a highly configurable and customizable boot-loader with modular architecture. It supports a wide range of kernel formats, file systems, computer architectures and hardware devices. It may be safely installed alongside legacy grub. Refer to the README.Mageia file that is part of this package's documentation for more information. %package efi Summary: Boot-loader with support for EFI Group: System/Boot and Init Conflicts: %{name} Recommends: os-prober >= 1.53 Requires(post): efibootmgr Recommends: %{name}-mageia-theme = %{version}-%{release} Provides: bootloader Provides: grub2bootloader %description efi This is the second version of the GRUB (Grand Unified Boot-loader), a highly configurable and customizable boot-loader with modular architecture. It supports a wide range of kernel formats, file systems, computer architectures and hardware devices. It may be safely installed alongside legacy grub. Refer to the README.Mageia and README.efi files that are part of this package's documentation for more information. %package mageia-theme Summary: Provides a graphical theme with a custom Mageia background for grub2 Group: System/Boot and Init Requires: grub2bootloader Conflicts: grub2-mageia3-theme-dejavu BuildArch: noarch %description mageia-theme This package provides a custom Mageia graphical theme. It is provided as a separate package so it may be easily excluded from minimal installations where a graphical theme is not required. %prep %setup -q -n grub-%{tarver} %apply_patches # README.Mageia cp %{SOURCE3} . # README.efi cp %{SOURCE4} . cd .. rm -rf grub-efi-%{tarver} mv grub-%{tarver} grub-efi-%{tarver} %setup -q -n grub-%{tarver} %apply_patches # README.Mageia cp %{SOURCE3} . # README.efi cp %{SOURCE4} . %build cd .. pushd grub-%{tarver} ./autogen.sh %configure2_5x TARGET_LDFLAGS=-static \ --with-platform=pc \ --enable-grub-emu-usb \ --disable-werror \ --enable-grub-mkfont \ --program-transform-name=s,grub,%{name}, \ --with-bootdir=/boot \ --with-grubdir=/%{name} \ CFLAGS="" %make popd pushd grub-efi-%{tarver} ./autogen.sh %configure2_5x TARGET_LDFLAGS=-static \ --with-platform=efi \ %ifarch x86_64 --target=x86_64 \ %endif --enable-grub-emu-usb \ --disable-werror \ --enable-grub-mkfont \ --program-transform-name=s,grub,%{name}, \ --with-bootdir=/boot \ --with-grubdir=/%{name} \ CFLAGS="" %make popd %install cd .. pushd grub-efi-%{tarver} %makeinstall_std popd pushd grub-%{tarver} %makeinstall_std # (bor) grub.info is harcoded in sources mv %{buildroot}%{_infodir}/grub.info %{buildroot}%{_infodir}/%{name}.info # Script that makes part of grub.cfg persist across updates install -m 755 %{SOURCE1} %{buildroot}%{_sysconfdir}/grub.d # Memtest install -m 755 %{SOURCE16} %{buildroot}%{_sysconfdir}/grub.d # Font install -d %{buildroot}/boot/%{name}/fonts install -D %{SOURCE9} %{buildroot}/boot/%{name}/fonts # Theme install -d %{buildroot}/boot/%{name}/themes/maggy install -D %{SOURCE7} %{buildroot}/boot/%{name}/themes/maggy install -D %{SOURCE10} %{buildroot}/boot/%{name}/themes/maggy install -D %{SOURCE11} %{buildroot}/boot/%{name}/themes/maggy install -D %{SOURCE12} %{buildroot}/boot/%{name}/themes/maggy install -D %{SOURCE13} %{buildroot}/boot/%{name}/themes/maggy install -D %{SOURCE14} %{buildroot}/boot/%{name}/themes/maggy # Ghost config files install -d %{buildroot}/boot/%{name} touch %{buildroot}/boot/%{name}/grub.cfg # Workaround for RHL Bug 817187 install -d %{buildroot}%{_datadir}/locale/en/LC_MESSAGES ln -s %{_datadir}/locale/en@quot/LC_MESSAGES/grub.mo %{buildroot}%{_datadir}/locale/en/LC_MESSAGES/grub.mo cat > %{buildroot}/boot/%{name}/custom.cfg < %{buildroot}%{_bindir}/update-grub <> /var/log/%{name}_post.log< Boot to set up %{name} or create the file: /boot/%{name}/drakboot.conf containing boot=/dev/sdX where /dev/sdX is the boot device. EOF cat /var/log/%{name}_post.log fi fi %post efi # (tmb) WIP if [ $1 -eq 1 ]; then rm -f /var/log/%{name}_post.log # Determine the partition with /boot BOOT_PARTITION=$(df -h /boot |(read; awk '{print $1; exit}')) # Generate core.img %{name}-install --force --directory=%{_libdir}/grub/%{efi_arch} --grub-setup=/bin/true $BOOT_PARTITION # On update re-install grub2 to where it was installed by drakboot # otherwise next boot may fail due to mismatched boot code. # If grub2 was manually installed (outside drakboot) and no drakboot.conf exists # then print warning. # Check for drakboot.conf if [ $1 -eq 2 ]; then if [ -e /boot/%{name}/drakboot.conf ]; then # Get install device from drakboot.conf install_dev=$(cat /boot/%{name}/drakboot.conf|grep "boot="|cut -d= -f2) # Check it's not a partition if ! echo $install_dev | grep -q "[0-9]"; then echo "Installing %{name} to $install_dev" | tee -a /var/log/%{name}_post.log %{name}-install $install_dev fi else cat >> /var/log/%{name}_post.log< Boot to set up %{name} or create the file: /boot/%{name}/drakboot.conf containing boot=/dev/sdX where /dev/sdX is the boot device. EOF cat /var/log/%{name}_post.log fi fi # Generate grub.cfg only on install if [ $1 -eq 1 ]; then %{name}-mkconfig -o /boot/%{name}/grub.cfg fi fi %post mageia-theme # Don't install if updating if [ $1 -eq 1 ] ; then # Remove trailing blank lines from /etc/default/grub sed -i -e :a -e '/^\n*$/{$d;N;};/\n$/ba' %{_sysconfdir}/default/grub # Check that /etc/default/grub ends in a linefeed [ "$(tail -n 1 %{_sysconfdir}/default/grub | wc --lines)" = "1" ] || echo >> %{_sysconfdir}/default/grub # Add theme echo "GRUB_THEME=/boot/grub2/themes/maggy/theme.txt" >> %{_sysconfdir}/default/grub fi %preun exec > /var/log/%{name}_preun.log 2>&1 # Only if uninstalling if [ $1 -eq 0 ]; then rm -rf /boot/%{name}/%{pc_arch} rm -rf /boot/%{name}/locale fi %preun efi exec > /var/log/%{name}_preun.log 2>&1 # Only if uninstalling if [ $1 -eq 0 ]; then rm -rf /boot/%{name}/%{efi_arch} rm -rf /boot/%{name}/locale fi # If updating grub2-efi from version below 2.02-0.git9752.4 then re-generate menu (Mga#13493) # because Fedora patches to use "linuxefi" have now been removed. %triggerpostun efi -- %{name}-efi < 2.02-0.git9752.4 %{name}-mkconfig -o /boot/%{name}/grub.cfg %postun mageia-theme exec > /var/log/%{name}_theme_postun.log 2>&1 # Only if uninstalling theme if [ $1 -eq 0 ]; then # Remove theme from config sed -i '/GRUB_THEME=\/boot\/grub2\/themes\/maggy\/theme.txt/d' %{_sysconfdir}/default/grub fi %files -f grub.lang %doc COPYING NEWS README THANKS TODO README.Mageia %{_infodir}/* %dir %{_libdir}/grub %dir %{_libdir}/grub/i386-pc %dir /boot/%{name} %dir /boot/%{name}/fonts %dir /boot/%{name}/themes %{_libdir}/grub/i386-pc/* %{_bindir}/%{name}-* %{_bindir}/update-grub %{_bindir}/update-grub2 %{_sbindir}/%{name}-* %{_sysconfdir}/bash_completion.d/grub %{_sysconfdir}/grub.d/README %{_sysconfdir}/grub.d/00_header %{_sysconfdir}/grub.d/10_linux %{_sysconfdir}/grub.d/20_linux_xen %{_sysconfdir}/grub.d/20_ppc_terminfo %{_sysconfdir}/grub.d/93_memtest %{_sysconfdir}/grub.d/30_os-prober %{_sysconfdir}/grub.d/90_persistent %config(noreplace) %{_sysconfdir}/grub.d/40_custom %config(noreplace) %{_sysconfdir}/grub.d/41_custom %config(noreplace) %{_sysconfdir}/default/grub %{_datadir}/grub %config(noreplace) /boot/%{name}/grub.cfg %config(noreplace) /boot/%{name}/custom.cfg %{_mandir}/man1/%{name}-*.1* %{_mandir}/man8/%{name}-*.8* %{_filetriggers_dir}/%{name}.filter %{_filetriggers_dir}/%{name}.script %files efi -f grub.lang %doc COPYING NEWS README THANKS TODO README.Mageia README.efi %{_infodir}/* %dir %{_libdir}/grub %dir %{_libdir}/grub/%{efi_arch} %dir /boot/%{name} %dir /boot/%{name}/fonts %dir /boot/%{name}/themes %{_libdir}/grub/%{efi_arch}/* %{_bindir}/%{name}-* %{_bindir}/update-grub %{_bindir}/update-grub2 %{_sbindir}/%{name}-* %{_sysconfdir}/bash_completion.d/grub %{_sysconfdir}/grub.d/README %{_sysconfdir}/grub.d/00_header %{_sysconfdir}/grub.d/10_linux %{_sysconfdir}/grub.d/20_linux_xen %{_sysconfdir}/grub.d/20_ppc_terminfo %{_sysconfdir}/grub.d/93_memtest %{_sysconfdir}/grub.d/30_os-prober %{_sysconfdir}/grub.d/90_persistent %config(noreplace) %{_sysconfdir}/grub.d/40_custom %config(noreplace) %{_sysconfdir}/grub.d/41_custom %config(noreplace) %{_sysconfdir}/default/grub %{_datadir}/grub %config(noreplace) /boot/%{name}/grub.cfg %config(noreplace) /boot/%{name}/custom.cfg %{_mandir}/man1/%{name}-*.1* %{_mandir}/man8/%{name}-*.8* %{_filetriggers_dir}/%{name}.filter %{_filetriggers_dir}/%{name}.script %files mageia-theme /boot/%{name}/fonts/unicode.pf2 %dir /boot/%{name}/themes/maggy /boot/%{name}/themes/maggy/*