SHA256
1
0
forked from pool/grub2

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
This commit is contained in:
Jiri Slaby 2013-03-12 09:56:29 +00:00 committed by Git OBS Bridge
parent 4a27c23e24
commit 5932ec5ef7
2 changed files with 51 additions and 21 deletions

View File

@ -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

View File

@ -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
if [ "x${LOADER_TYPE}" = "xgrub2-efi" ] && [ "$migrate_grub2_efi" ]; then
# Migrate settings to standard prefix /boot/grub2
for i in custom.cfg device.map grub.cfg grubenv; do
for i in custom.cfg grubenv; do
[ -f /boot/%{name}-efi/$i ] && cp -a /boot/%{name}-efi/$i /boot/%{name} || :
done
fi
# 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