Rename script and rebuild initrd on ucode or firmware change
This commit is contained in:
parent
2f39219cc6
commit
6217fe734a
|
@ -4,8 +4,17 @@ Operation = Install
|
|||
Operation = Upgrade
|
||||
Target = usr/lib/modules/*/vmlinuz
|
||||
|
||||
[Trigger]
|
||||
Type = Package
|
||||
Operation = Install
|
||||
Operation = Upgrade
|
||||
Operation = Remove
|
||||
Target = amd-ucode
|
||||
Target = intel-ucode
|
||||
Target = linux-firmware
|
||||
|
||||
[Action]
|
||||
Description = Installing kernel...
|
||||
Description = Running kernel-install...
|
||||
When = PostTransaction
|
||||
Exec = /usr/share/libalpm/scripts/kernel-install add
|
||||
Exec = /usr/share/libalpm/scripts/kernel-install-hook add
|
||||
NeedsTargets
|
||||
|
|
|
@ -6,5 +6,5 @@ Target = usr/lib/modules/*/vmlinuz
|
|||
[Action]
|
||||
Description = Removing kernel...
|
||||
When = PreTransaction
|
||||
Exec = /usr/share/libalpm/scripts/kernel-install remove
|
||||
Exec = /usr/share/libalpm/scripts/kernel-install-hook remove
|
||||
NeedsTargets
|
||||
|
|
|
@ -1,12 +1,27 @@
|
|||
#!/usr/bin/env bash
|
||||
|
||||
while read -r line; do
|
||||
if [[ $line != */vmlinuz ]]; then
|
||||
# this means this is something other than a kernel change
|
||||
all=1
|
||||
continue
|
||||
fi
|
||||
|
||||
version=$(basename "${line%/vmlinuz}")
|
||||
echo ":: Running kernel-install for kernel $version"
|
||||
|
||||
kernel-install $1 "${version}" "${line}"
|
||||
done
|
||||
|
||||
if [[ $all == 1 ]]; then
|
||||
# Run kernel-install for all the installed kernels
|
||||
while read -r kernel; do
|
||||
kernelversion=$(basename "${kernel%/vmlinuz}")
|
||||
echo "Running kernel-install for ${kernelversion}"
|
||||
kernel-install add ${kernelversion} ${kernel}
|
||||
done < <(find /usr/lib/modules -maxdepth 2 -type f -name vmlinuz)
|
||||
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'
|
Loading…
Reference in New Issue