Automate VMWare Kernel Module installation after updating kernel in Fedora 41

Hello anyone.
I now back to Fedora and using Fedora 41 KDE Spin. I want to automate VMWare installation after updating kernel. I write it in /etc/kernel/install.d/ like this :

anifyuli@ThinkPad-X280:~$ cat /etc/kernel/install.d/99-vmmodules.install 
#!/usr/bin/bash

export LANG=C

COMMAND="$1"

ret=0

case "$COMMAND" in
    add)

       /usr/bin/vmware-modconfig --console --install-all

       ((ret+=$?))
       ;;
    remove)
        exit 0
        ;;
    *)
        usage
        ret=1;;
esac

exit $ret

But it not triggered after I update my kernel last night. How should I do to enable it automatically? Thanks for your help :pray:t2:

I get this in reinstall proccess :

>>> Running pre-uninstall scriptlet: kernel-core-0:6.11.11-300.fc41.x86_64
>>> Error in pre-uninstall scriptlet: kernel-core-0:6.11.11-300.fc41.x86_64
>>> Scriptlet output:
>>> /etc/kernel/install.d/99-vmmodules.install failed with exit status 127.
>>> 
>>> [RPM] %preun(kernel-core-6.11.11-300.fc41.x86_64) scriptlet failed, exit status 127
>>> Running post-transaction scriptlet: kernel-core-0:6.11.11-300.fc41.x86_64
>>> Non-critical error in post-transaction scriptlet: kernel-core-0:6.11.11-300.fc41.x86_64
>>> Scriptlet output:
>>> /etc/kernel/install.d/99-vmmodules.install failed with exit status 127.
>>> 
>>> [RPM] kernel-core-6.11.11-300.fc41.x86_64: erase failed
>>> [RPM] %posttrans(kernel-core-6.11.11-300.fc41.x86_64) scriptlet failed, exit status 127
Transaction failed: Rpm transaction failed.

What should I do for fix that?

I can’t find it logs, how should I do to get that?

It show like this :

remove 6.11.11-300.fc41.x86_64 /boot/5882276f63f44826aefec3b009a2b5d3/6.11.11-300.fc41.x86_64
/etc/kernel/install.d/99-vmmodules.install: line 4: ...: command not found
add 6.11.11-300.fc41.x86_64 /boot/5882276f63f44826aefec3b009a2b5d3/6.11.11-300.fc41.x86_64 /lib/modules/6.11.11-300.fc41.x86_64/vmlinuz
/etc/kernel/install.d/99-vmmodules.install: line 4: ...: command not found
remove 6.11.11-300.fc41.x86_64 /boot/5882276f63f44826aefec3b009a2b5d3/6.11.11-300.fc41.x86_64
/etc/kernel/install.d/99-vmmodules.install: line 5: ...: command not found
remove 6.11.11-300.fc41.x86_64 /boot/5882276f63f44826aefec3b009a2b5d3/6.11.11-300.fc41.x86_64
/etc/kernel/install.d/99-vmmodules.install: line 5: ...: command not found
add 6.11.11-300.fc41.x86_64 /boot/5882276f63f44826aefec3b009a2b5d3/6.11.11-300.fc41.x86_64 /lib/modules/6.11.11-300.fc41.x86_64/vmlinuz
/etc/kernel/install.d/99-vmmodules.install: line 5: ...: command not found

But why my script change like this?

#!/usr/bin/bash
exec &>> /tmp/kernel-install.log
exec &>> /tmp/kernel-install.log
echo ${@}
...

Ok, my script works correctly, how to hide make output?

Ok, I found this problem solution. My script not run because not getting execute modifier, and I add >& /dev/null on after VMWare kernel module install command to hide it outputs. Thanks for @vgaetera to assist me to troubleshoot this issues. Thank you very much :pray:t2: