From babdcda8d250771015a042989f599b1db86a646f Mon Sep 17 00:00:00 2001 From: Peter Georg Date: Aug 09 2021 07:47:43 +0000 Subject: Rebuild initramfs --- diff --git a/SPECS/kmod-be2net.spec b/SPECS/kmod-be2net.spec index 05d9b66..a8682a0 100644 --- a/SPECS/kmod-be2net.spec +++ b/SPECS/kmod-be2net.spec @@ -67,6 +67,9 @@ Provides: %{name}-%{kernel_version}.%{_arch} = %{?epoch:%{epoch}:}%{vers Requires(post): /usr/sbin/depmod Requires(postun): /usr/sbin/depmod +Requires(post): /usr/bin/dracut +Requires(postun): /usr/bin/dracut + %description This package provides the %{pkg} driver. Compared to the in-kernel driver this @@ -120,6 +123,19 @@ then /usr/sbin/depmod -aeF /lib/modules/%{kernel_version}.%{_arch}/System.map %{kernel_version}.%{_arch} fi + if [ -f /boot/initramfs-%{kernel_version}.%{_arch}.img ] + then + if /usr/bin/dracut -f --rebuild /boot/initramfs-%{kernel_version}.%{_arch}.img /boot/initramfs-%{kernel_version}.%{_arch}.img.rpmnew %{kernel_version}.%{_arch} + then + if ! cmp -s /boot/initramfs-%{kernel_version}.%{_arch}.img /boot/initramfs-%{kernel_version}.%{_arch}.img.rpmnew + then + mv /boot/initramfs-%{kernel_version}.%{_arch}.img.rpmnew /boot/initramfs-%{kernel_version}.%{_arch}.img + else + rm -f /boot/initramfs-%{kernel_version}.%{_arch}.img.rpmnew + fi + fi + fi + rm -f %{_localstatedir}/lib/rpm-state/sig-kmods/%{kernel_version}.%{_arch} rmdir --ignore-fail-on-non-empty %{_localstatedir}/lib/rpm-state/sig-kmods fi @@ -133,6 +149,19 @@ then /usr/sbin/depmod -aeF /lib/modules/%{kernel_version}.%{_arch}/System.map %{kernel_version}.%{_arch} fi + if [ -f /boot/initramfs-%{kernel_version}.%{_arch}.img ] + then + if /usr/bin/dracut -f --rebuild /boot/initramfs-%{kernel_version}.%{_arch}.img /boot/initramfs-%{kernel_version}.%{_arch}.img.rpmnew %{kernel_version}.%{_arch} + then + if ! cmp -s /boot/initramfs-%{kernel_version}.%{_arch}.img /boot/initramfs-%{kernel_version}.%{_arch}.img.rpmnew + then + mv /boot/initramfs-%{kernel_version}.%{_arch}.img.rpmnew /boot/initramfs-%{kernel_version}.%{_arch}.img + else + rm -f /boot/initramfs-%{kernel_version}.%{_arch}.img.rpmnew + fi + fi + fi + rm -f %{_localstatedir}/lib/rpm-state/sig-kmods/%{kernel_version}.%{_arch} rmdir --ignore-fail-on-non-empty %{_localstatedir}/lib/rpm-state/sig-kmods fi