Don't do sysadminny things in %preun or %post ever. (#735259)

grub2-install and removing old installs are not the package's business,
and they break package updates.
This commit is contained in:
Peter Jones 2011-09-02 10:57:30 -04:00
parent 62686d201e
commit 5c9195d690

View File

@ -217,26 +217,16 @@ rm $RPM_BUILD_ROOT/usr/share/locale/*/LC_MESSAGES/grub.mo
rm -rf $RPM_BUILD_ROOT rm -rf $RPM_BUILD_ROOT
%post %post
# Determine the partition with /boot
BOOT_PARTITION=$(df -h /boot |(read; awk '{print $1; exit}'))
# Generate core.img, but don't let it be installed in boot sector
%{name}-install --grub-setup=/bin/true $BOOT_PARTITION
if [ "$1" = 1 ]; then if [ "$1" = 1 ]; then
/sbin/install-info --info-dir=%{_infodir} %{_infodir}/grub2.info.gz || : /sbin/install-info --info-dir=%{_infodir} %{_infodir}/grub2.info.gz || :
/sbin/install-info --info-dir=%{_infodir} %{_infodir}/grub2-dev.info.gz || : /sbin/install-info --info-dir=%{_infodir} %{_infodir}/grub2-dev.info.gz || :
fi fi
%preun %preun
if [ "$1" = 0 ]; then if [ "$1" = 0 ]; then
/sbin/install-info --delete --info-dir=%{_infodir} %{_infodir}/grub2.info.gz || : /sbin/install-info --delete --info-dir=%{_infodir} %{_infodir}/grub2.info.gz || :
/sbin/install-info --delete --info-dir=%{_infodir} %{_infodir}/grub2-dev.info.gz || : /sbin/install-info --delete --info-dir=%{_infodir} %{_infodir}/grub2-dev.info.gz || :
fi fi
# XXX Ugly
rm -f /boot/%{name}/*.mod
rm -f /boot/%{name}/*.img
rm -f /boot/%{name}/*.lst
rm -f /boot/%{name}/device.map
%files %files
%defattr(-,root,root,-) %defattr(-,root,root,-)