%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 Name: grub2 Version: 2.00 Release: %mkrel 59 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-%{version}.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: Mageia-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-9066.patch # Fix freetype include Patch2: grub2-ftsynth_h.patch # Fedora patches not upstream Patch0443: 0443-Migrate-PPC-from-Yaboot-to-Grub2.patch Patch0444: 0444-Add-fw_path-variable-revised.patch Patch0445: 0445-Don-t-set-boot-device-on-ppc-ieee1275.patch Patch0446: 0446-Add-support-for-linuxefi.patch Patch0448: 0448-Use-linuxefi-and-initrdefi-where-appropriate.patch Patch0449: 0449-Don-t-allow-insmod-when-secure-boot-is-enabled.patch Patch0450: 0450-Pass-x-hex-hex-straight-through-unmolested.patch Patch0451: 0451-Fix-crash-on-http.patch Patch0455: 0455-Add-X-option-to-printf-functions.patch Patch0458: 0458-Add-bootpath-device-to-the-list.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 Patch0474: 0474-Message-string-cleanups.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 Patch0480: 0480-Disable-GRUB-video-support-for-IBM-power-machines.patch Patch0481: 0481-Revert-Add-bootpath-device-to-the-list-967862.patch Patch0483: 0483-Initialize-grub_file_filters_-all-enabled.patch BuildRequires: flex BuildRequires: bison BuildRequires: ruby BuildRequires: binutils BuildRequires: glibc-static-devel BuildRequires: ncurses-devel BuildRequires: liblzo-devel BuildRequires: freetype2-devel BuildRequires: libusb-devel BuildRequires: help2man BuildRequires: texinfo BuildRequires: libdevmapper-devel BuildRequires: fuse-devel BuildRequires: autogen Conflicts: %{name}-efi Suggests: os-prober >= 1.53 Suggests: %{name}-mageia-theme = %{version}-%{release} Provides: bootloader Provides: grub2bootloader %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} Suggests: os-prober >= 1.53 Requires(post): efibootmgr Suggests: %{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-%{version} %apply_patches # README.Mageia cp %{SOURCE3} . # README.efi cp %{SOURCE4} . cd .. rm -rf grub-efi-%{version} mv grub-%{version} grub-efi-%{version} %setup -q -n grub-%{version} %apply_patches # README.Mageia cp %{SOURCE3} . # README.efi cp %{SOURCE4} . %build cd .. pushd grub-%{version} ./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-%{version} ./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-%{version} %makeinstall_std popd pushd grub-%{version} %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 2>&1 # Determine the partition with /boot BOOT_PARTITION=$(df -h /boot |(read; awk '{print $1; exit}')) # make it work with live images if [ "$BOOT_PARTITION" == "overlayfs" ]; then BOOT_PARTITION=$(df -h /mnt/install/boot |(read; awk '{print $1; exit}')) fi # Generate core.img, but don't let it be installed in boot sector %{name}-install --directory=%{_libdir}/grub/%{pc_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) do nothing. # This will also re-build the menu. if [ $1 -eq 2 ] && [ -e /boot/grub2/drakboot.conf ]; then install_part=$(cat /boot/grub2/drakboot.conf|grep "boot="|cut -d= -f2) root_part=$(df -h / |(read; awk '{print $1; exit}')) if [ "$root_part" != "$install_part" ]; then %{name}-install $install_part fi fi # Generate grub.cfg only on install if [ $1 -eq 1 ]; then %{name}-mkconfig -o /boot/%{name}/grub.cfg fi %post efi exec > /var/log/%{name}_post.log 2>&1 # Determine the partition with /boot BOOT_PARTITION=$(df -h /boot |(read; awk '{print $1; exit}')) # make it work with live images if [ "$BOOT_PARTITION" == "overlayfs" ]; then BOOT_PARTITION=$(df -h /mnt/install/boot |(read; awk '{print $1; exit}')) fi # Generate core.img, but don't let it be installed in boot sector %{name}-install --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) do nothing. # This will also re-build the menu. if [ $1 -eq 2 ] && [ -e /boot/grub2/drakboot.conf ]; then install_part=$(cat /boot/grub2/drakboot.conf|grep "boot="|cut -d= -f2) root_part=$(df -h / |(read; awk '{print $1; exit}')) if [ "$root_part" != "$install_part" ]; then %{name}-install $install_part fi fi # Generate grub.cfg only on install if [ $1 -eq 1 ]; then %{name}-mkconfig -o /boot/%{name}/grub.cfg 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 %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/*