From 5932ec5ef7988b9c3ebd149706f281126466688a3176599c8c91127cc9800c58 Mon Sep 17 00:00:00 2001 From: Jiri Slaby Date: Tue, 12 Mar 2013 09:56:29 +0000 Subject: [PATCH 1/2] Accepting request 158628 from home:arvidjaar:branches:Base:System Clean up spec 1. update-bootloader must be called after both user space and grub2 modules are updated. Otherwise we risk to get stale modules or incompatible configuration. So move it into respective grub2-i386-pc/grub2-arch-efi; use Requires(post) to force packages installation order. 2. Split migration support into grub2-efi. Simplify it, only grubenv and custom.cfg need migration. 3. Require minimal perl-Bootloader version that understands /boot/grub2 on EFI. While on it, replace all obsolete PreReq with Requires/Requies(post). This leaves all migration code under 12.2/12.3 condition, so once we are past this it will disappear. Tested on updated from 12.2. OBS-URL: https://build.opensuse.org/request/show/158628 OBS-URL: https://build.opensuse.org/package/show/Base:System/grub2?expand=0&rev=26 --- grub2.changes | 15 ++++++++++++++ grub2.spec | 57 ++++++++++++++++++++++++++++++++------------------- 2 files changed, 51 insertions(+), 21 deletions(-) diff --git a/grub2.changes b/grub2.changes index b390973..7d2a3f9 100644 --- a/grub2.changes +++ b/grub2.changes @@ -1,3 +1,18 @@ +------------------------------------------------------------------- +Mon Mar 11 16:02:26 UTC 2013 - arvidjaar@gmail.com + +- move post scripts into corresponding subpackages to ensure they are + run after updated binaries are installed. Currently it may happen + that update-bootlader picks up old binaries. +- move requires for perl-Bootloader to target subpackages. Make sure + efi requires minimal version that supports /boot/grub2. +- add requires(post) to force order of installation: grub2 => grub2-arch + => grub2-efi +- split efi post in two parts. One that updates configuration and is part + of grub2-efiarch and second that migrates settings and is part of + grub2-efi. Only custom.cfg and grubenv may need migration. device.map + is not relevant for EFI and new grub.cfg had been created at this point. + ------------------------------------------------------------------- Mon Mar 11 06:52:58 UTC 2013 - mchang@suse.com diff --git a/grub2.spec b/grub2.spec index 1c64493..1e365c6 100644 --- a/grub2.spec +++ b/grub2.spec @@ -135,7 +135,6 @@ Patch30: grub2-cdpath.patch Patch31: efidisk-ahci-workaround Patch32: grub2-grub-mount-return-failure-if-FUSE-failed.patch Patch33: grub2-fix-tftp-endianness.patch -PreReq: perl-Bootloader Requires: gettext-runtime %if 0%{?suse_version} >= 1140 Requires: os-prober @@ -176,6 +175,10 @@ Authors: Summary: Bootloader with support for Linux, Multiboot and more Group: System/Boot +Requires: %{name} = %{version}-%{release} +Requires(post): %{name} = %{version}-%{release} +Requires: perl-Bootloader +Requires(post): perl-Bootloader %description %{grubarch} The GRand Unified Bootloader (GRUB) is a highly configurable and customizable @@ -189,8 +192,8 @@ provides support for %{platform} systems. Summary: Bootloader with support for Linux, Multiboot and more Group: System/Boot -PreReq: %{name} = %{version}-%{release} -PreReq: %{name}-%{grubefiarch} = %{version}-%{release} +Requires: %{name}-%{grubefiarch} = %{version}-%{release} +Requires(pre): %{name}-%{grubefiarch} = %{version}-%{release} %description efi This is the second version of the GRUB (Grand Unified Bootloader), a @@ -218,7 +221,12 @@ Group: System/Boot %ifarch ia64 x86_64 #Package is available on ia64 and x86_64 only and not necessarily needed Requires: efibootmgr +Requires(post): efibootmgr %endif +Requires: %{name} = %{version}-%{release} +Requires(post): %{name} = %{version}-%{release} +Requires: perl-Bootloader >= 0.706 +Requires(post): perl-Bootloader >= 0.706 %description %{grubefiarch} The GRand Unified Bootloader (GRUB) is a highly configurable and customizable @@ -427,6 +435,8 @@ install -m 755 -D %{SOURCE6} $RPM_BUILD_ROOT%{_sbindir}/grub2-once /sbin/install-info %{_infodir}/%{name}.info %{_infodir}/dir || : %if ! 0%{?only_efi:1} + +%post %{grubarch} # To check by current loader settings if [ -f %{_sysconfdir}/sysconfig/bootloader ]; then . %{_sysconfdir}/sysconfig/bootloader @@ -505,14 +515,15 @@ else . %{_sysconfdir}/sysconfig/bootloader fi - if [ "x${LOADER_TYPE}" = "xgrub2-efi" ]; then - - if [ "$migrate_grub2_efi" ]; then - # Migrate settings to standard prefix /boot/grub2 - for i in custom.cfg device.map grub.cfg grubenv; do - [ -f /boot/%{name}-efi/$i ] && cp -a /boot/%{name}-efi/$i /boot/%{name} || : - done - fi + if [ "x${LOADER_TYPE}" = "xgrub2-efi" ] && [ "$migrate_grub2_efi" ]; then + # Migrate settings to standard prefix /boot/grub2 + for i in custom.cfg grubenv; do + [ -f /boot/%{name}-efi/$i ] && cp -a /boot/%{name}-efi/$i /boot/%{name} || : + done + # Uninstallation of previous grub2-efi versions will remove + # /boot/grub2-efi/grub.cfg and possibly /boot/grub2-efi itself. + # Preserve grub2.cfg and use it as migration flag in postun trigger + mv /boot/%{name}/grub.cfg /boot/%{name}/grub.cfg.migrated fi if [ "$migrate_grub2_efi" ]; then @@ -520,19 +531,23 @@ else ln -sf %{name} /boot/%{name}-efi fi - if [ "x${LOADER_TYPE}" = "xgrub2-efi" ]; then - # It's enough to call update-bootloader --refesh to install grub2 and update it's config - /sbin/update-bootloader --refresh || true - - # Uninstallation of previous grub2-efi versions will remove - # /boot/grub2-efi/grub.cfg and possibly /boot/grub2-efi itself. - # Preserve grub2.cfg and use it as migration flag in postun trigger - [ "$migrate_grub2_efi" ] && mv /boot/%{name}/grub.cfg /boot/%{name}/grub.cfg.migrated - fi - fi exit 0 %endif + +%post %{grubefiarch} + +# To check by current loader settings +if [ -f %{_sysconfdir}/sysconfig/bootloader ]; then + . %{_sysconfdir}/sysconfig/bootloader +fi + +if [ "x${LOADER_TYPE}" = "xgrub2-efi" ]; then + # It's enough to call update-bootloader --refesh to install grub2 and update it's config + /sbin/update-bootloader --refresh || true +fi + +exit 0 %endif %preun From 04d8f6bbb579068c20e3950d8c00af6b2558471d5dc5f3d0c7cdf3257509ae5f Mon Sep 17 00:00:00 2001 From: Andrei Borzenkov Date: Wed, 20 Mar 2013 16:58:19 +0000 Subject: [PATCH 2/2] Accepting request 160165 from home:michael-chang:test-upgrade1 Please review this v2. version. Thanks. v2. Renaming of grub2-efi unconditionally. - remove all compatible links in grub2-efi as now all concerned utilities are fixed - superseding grub2-efi by grub2-x86_64-efi and grub2-i386-efi on x86_64 and ix86 respectively - make grub2-x86_64-efi and grub2-i386-efi providing grub2-efi capability to not break package dependency - handle upgrade from 12.2 by preseving grubenv and custom.cfg to new directory /boot/grub2, rename /boot/grub2-efi to /boot/grub2-efi.rpmsave to avoid confusion. OBS-URL: https://build.opensuse.org/request/show/160165 OBS-URL: https://build.opensuse.org/package/show/Base:System/grub2?expand=0&rev=28 --- grub2.changes | 13 ++++++ grub2.spec | 120 +++++++------------------------------------------- 2 files changed, 28 insertions(+), 105 deletions(-) diff --git a/grub2.changes b/grub2.changes index 7d2a3f9..16f48ff 100644 --- a/grub2.changes +++ b/grub2.changes @@ -1,3 +1,16 @@ +------------------------------------------------------------------- +Wed Mar 13 11:30:52 UTC 2013 - mchang@suse.com + +- remove all compatible links in grub2-efi as now all concerned + utilities are fixed +- superseding grub2-efi by grub2-x86_64-efi and grub2-i386-efi on + x86_64 and ix86 respectively +- make grub2-x86_64-efi and grub2-i386-efi providing grub2-efi + capability to not break package dependency +- handle upgrade from 12.2 by preseving grubenv and custom.cfg to + new directory /boot/grub2, rename /boot/grub2-efi to + /boot/grub2-efi.rpmsave to avoid confusion. + ------------------------------------------------------------------- Mon Mar 11 16:02:26 UTC 2013 - arvidjaar@gmail.com diff --git a/grub2.spec b/grub2.spec index 1e365c6..a922877 100644 --- a/grub2.spec +++ b/grub2.spec @@ -187,32 +187,6 @@ file systems, computer architectures and hardware devices. This subpackage provides support for %{platform} systems. %ifarch %{efi} -%if 0%{?suse_version} == 1220 || 0%{?suse_version} == 1230 -%package efi - -Summary: Bootloader with support for Linux, Multiboot and more -Group: System/Boot -Requires: %{name}-%{grubefiarch} = %{version}-%{release} -Requires(pre): %{name}-%{grubefiarch} = %{version}-%{release} - -%description efi -This is the second version of the GRUB (Grand Unified Bootloader), a -highly configurable and customizable bootloader with modular -architecture. It support rich scale of kernel formats, file systems, -computer architectures and hardware devices. - - - -Authors: --------- - Gordon Matzigkeit - Yoshinori K. Okuji - Colin Watson - Colin D. Bennett - Vesa Jääskeläinen - Robert Millan - Carles Pina -%endif %package %{grubefiarch} @@ -227,6 +201,8 @@ Requires: %{name} = %{version}-%{release} Requires(post): %{name} = %{version}-%{release} Requires: perl-Bootloader >= 0.706 Requires(post): perl-Bootloader >= 0.706 +Provides: %{name}-efi = %{version}-%{release} +Obsoletes: %{name}-efi < %{version}-%{release} %description %{grubefiarch} The GRand Unified Bootloader (GRUB) is a highly configurable and customizable @@ -413,17 +389,6 @@ rm $RPM_BUILD_ROOT/%{_libdir}/%{name}/*/*.h rm $RPM_BUILD_ROOT%{_datadir}/%{name}/*.h %endif -%ifarch %{efi} -%if 0%{?suse_version} == 1220 || 0%{?suse_version} == 1230 -# grub2-efi compatibility links until other packages are fixed -ln -sf %{name}-editenv $RPM_BUILD_ROOT%{_bindir}/%{name}-efi-editenv -ln -sf %{name}-set-default $RPM_BUILD_ROOT%{_sbindir}/%{name}-efi-set-default -ln -sf %{name}-mkconfig $RPM_BUILD_ROOT%{_sbindir}/%{name}-efi-mkconfig -ln -sf %{name}-install $RPM_BUILD_ROOT%{_sbindir}/%{name}-efi-install -ln -sf %{name} $RPM_BUILD_ROOT/boot/%{name}-efi -%endif -%endif - # Defaults install -m 644 -D %{SOURCE2} $RPM_BUILD_ROOT%{_sysconfdir}/default/grub install -m 755 -D %{SOURCE6} $RPM_BUILD_ROOT%{_sbindir}/grub2-once @@ -477,63 +442,6 @@ fi %endif %ifarch %{efi} -%if 0%{?suse_version} == 1220 || 0%{?suse_version} == 1230 - -%triggerpostun -- %{name}-efi - -# It is needed on update only -if [ $2 -gt 0 ]; then - - # Workaround for lost /boot/grub2/grub.cfg and possibly /boot/grub2-efi - # after old grub2-efi deinstallation - if [ -f /boot/%{name}/grub.cfg.migrated ]; then - mv /boot/%{name}/grub.cfg.migrated /boot/%{name}/grub.cfg - fi - [ -h /boot/%{name}-efi ] || ln -sf %{name} /boot/%{name}-efi - -fi -exit 0 - -%post efi - -if [ $1 -eq 1 ]; then - - # If this is new install, just create compatibility link - ln -sf grub2 /boot/grub2-efi - -else - - # Always create compatibility link even if current loader is not grub2-efi - if [ -h /boot/%{name}-efi ]; then - migrate_grub2_efi= - else - migrate_grub2_efi=yes - fi - - # To check by current loader settings - if [ -f %{_sysconfdir}/sysconfig/bootloader ]; then - . %{_sysconfdir}/sysconfig/bootloader - fi - - if [ "x${LOADER_TYPE}" = "xgrub2-efi" ] && [ "$migrate_grub2_efi" ]; then - # Migrate settings to standard prefix /boot/grub2 - for i in custom.cfg grubenv; do - [ -f /boot/%{name}-efi/$i ] && cp -a /boot/%{name}-efi/$i /boot/%{name} || : - done - # Uninstallation of previous grub2-efi versions will remove - # /boot/grub2-efi/grub.cfg and possibly /boot/grub2-efi itself. - # Preserve grub2.cfg and use it as migration flag in postun trigger - mv /boot/%{name}/grub.cfg /boot/%{name}/grub.cfg.migrated - fi - - if [ "$migrate_grub2_efi" ]; then - mv /boot/%{name}-efi /boot/%{name}-efi.rpmsave - ln -sf %{name} /boot/%{name}-efi - fi - -fi -exit 0 -%endif %post %{grubefiarch} @@ -543,10 +451,23 @@ if [ -f %{_sysconfdir}/sysconfig/bootloader ]; then fi if [ "x${LOADER_TYPE}" = "xgrub2-efi" ]; then + + if [ -d /boot/%{name}-efi ]; then + # Migrate settings to standard prefix /boot/grub2 + for i in custom.cfg grubenv; do + [ -f /boot/%{name}-efi/$i ] && cp -a /boot/%{name}-efi/$i /boot/%{name} || : + done + + fi + # It's enough to call update-bootloader --refesh to install grub2 and update it's config /sbin/update-bootloader --refresh || true fi +if [ -d /boot/%{name}-efi ]; then + mv /boot/%{name}-efi /boot/%{name}-efi.rpmsave +fi + exit 0 %endif @@ -658,17 +579,6 @@ fi %ifarch %{efi} -%if 0%{?suse_version} == 1220 || 0%{?suse_version} == 1230 -%files efi -%defattr(-,root,root,-) -%doc README -%ghost /boot/grub2-efi -%{_sbindir}/grub2-efi-install -%{_sbindir}/grub2-efi-mkconfig -%{_sbindir}/grub2-efi-set-default -%{_bindir}/grub2-efi-editenv -%endif - %files %{grubefiarch} %defattr(-,root,root,-) %dir %{_libdir}/%{name}/%{grubefiarch}