Solution to "double-generation" of initcpio image(s) when both kernel(s) and Nvidia driver(s) are being updated

Hi @schinfo and @philm, pls take a look at this hook:

Type = Path
Operation = Install
Operation = Upgrade
Operation = Remove
Target = usr/lib/modules/*/nvidia-drm*
Target = usr/lib/modules/*/vmlinuz

Description = Updating Kernel initcpios for Nvidia-DRM...
Depends = mkinitcpio
When = PostTransaction
Exec = /bin/sh -c 'while read -r trg; do case $trg in usr/lib/modules/*/vmlinuz) exit 0; esac; done; /usr/bin/mkinitcpio -P'

This is how /usr/share/libalpm/hooks/90-nvidia-utils.hook should look like in order to avoid generating initcpio image(s) twice when updating both kernel(s) and Nvidia driver(s).
Inspired by this: NVIDIA - ArchWiki
I don’t fully understand how it works but I tested in in different combinations, and yes, this way it works correctly.