Fix non-kernel triggers

This commit is contained in:
dalto 2023-10-01 10:37:30 -05:00
parent b553a85099
commit 85eb991993
2 changed files with 18 additions and 4 deletions

View file

@ -2,7 +2,7 @@
Type = Path
Operation = Install
Operation = Upgrade
Target = usr/lib/modules/*/vmlinuz
Operation = Remove
Target = usr/lib/initcpio/*
Target = usr/lib/firmware/*
Target = usr/src/*/dkms.conf
@ -15,6 +15,12 @@ Operation = Remove
Target = amd-ucode
Target = intel-ucode
[Trigger]
Type = Path
Operation = Install
Operation = Upgrade
Target = usr/lib/modules/*/vmlinuz
[Action]
Description = Installing kernel...
When = PostTransaction

View file

@ -6,14 +6,22 @@ while read -r line; do
echo ":: kernel-install removing kernel $version"
kernel-install remove "${version}"
elif [[ $1 == "add" ]]; then
echo ":: kernel-install installing kernel $version"
kernel-install add "${version}" "${line}"
if [[ line =~ ".*vmlinuz$" ]]; then
echo ":: kernel-install installing kernel $version"
kernel-install add "${version}" "${line}"
else
install_all=1
break
fi
else
echo ":: Invalid option passed to kernel-install script"
fi
version=$(basename "${line%/vmlinuz}")
done
if [[ $install_all == 1 ]]; then
reinstall-kernels
fi
# first check if we are running in a chroot
if [ "$(stat -c %d:%i /)" != "$(stat -c %d:%i /proc/1/root/.)" ]; then
echo 'Running in a chroot, skipping cmdline generation'