From 5ba83289c84864e7e18b67f09aac4201d5cbebcd Mon Sep 17 00:00:00 2001 From: wangkaiyuan Date: Sat, 22 Feb 2025 11:32:09 +0800 Subject: [PATCH] spec: modify the dracut execution judgment file Signed-off-by: wangkaiyuan --- kmod-bnxt.spec | 16 +++++++++------- 1 file changed, 9 insertions(+), 7 deletions(-) diff --git a/kmod-bnxt.spec b/kmod-bnxt.spec index 3f7b51e..fcc390b 100644 --- a/kmod-bnxt.spec +++ b/kmod-bnxt.spec @@ -123,7 +123,7 @@ depmod -a > /dev/null 2>&1 if [ -x "/usr/sbin/weak-modules" ]; then printf '%s\n' "/lib/modules/%{kernel}.%{_arch}/extra/%{pkg}/bnxt_en.ko" | /usr/sbin/weak-modules --no-initramfs --add-modules fi -if [ ! -e "/tmp/anaconda_tmp" ]; then dracut -f > /dev/null 2>&1 ;fi +if [ -e "/boot/initramfs-`uname -r`.img" ]; then dracut -f > /dev/null 2>&1 ;fi if [ -d /usr/local/share/%{name} ]; then rm -rf /usr/local/share/%{name} @@ -678,12 +678,14 @@ rm /var/run/rpm-bnxt_en-modules.list if which dracut >/dev/null 2>&1; then echo "Updating initramfs with dracut..." - if dracut --force ; then - echo "Successfully updated initramfs." - else - echo "Failed to update initramfs." - echo "You must update your initramfs image for changes to take place." - exit -1 + if [ -e "/boot/initramfs-`uname -r`.img" ]; then + if dracut --force ; then + echo "Successfully updated initramfs." + else + echo "Failed to update initramfs." + echo "You must update your initramfs image for changes to take place." + exit -1 + fi fi elif which mkinitrd >/dev/null 2>&1; then echo "Updating initrd with mkinitrd..." -- Gitee