[Trigger]
Operation = Install
Operation = Upgrade
Operation = Remove
Type = Package
Target = linux
Target = linux-next*
Target = linux-new*
Target = linux-amd*
Target = linux-lts*
Target = linux-zen*
Target = linux-rt*
Target = linux-hardened*
Target = linux-xanmod*
Target = linux-tkg*
Target = linux-raven*
Target = linux-slim*
Target = linux-test*
Target = linux-main*
Target = linux-dctxmei*
Target = linux-froidzen*
Target = linux-jwrdegoede*

[Action]
Depends = grub
Description = Updating GRUB configuration automatically after kernel operations
When = PostTransaction
Exec = /bin/sh -c "
if command -v grub-mkconfig >/dev/null 2>&1; then
    echo 'Updating GRUB configuration...';
    grub-mkconfig -o /boot/grub/grub.cfg && \
    echo 'GRUB configuration updated successfully.' || \
    echo 'Error: Failed to update GRUB configuration.' >&2;
else
    echo 'Error: grub-mkconfig not found. Ensure GRUB is installed.' >&2;
    exit 1;
fi"
