pacman-hook-kernel-install: Script and hook fixes#5
Conversation
Such a broad target for the remove hook can cause missing boot entries when something other than the kernel is updated. Signed-off-by: Eric Naim <dnaim@cachyos.org>
kernel-install has a handy helper `add-all`. Use that instead of iterating each vmlinuz manually. Additionally, exit the while loop when all_kernels=1. Signed-off-by: Eric Naim <dnaim@cachyos.org>
There are a lot of redundant targets that are already covered by another. Remove them. Signed-off-by: Eric Naim <dnaim@cachyos.org>
When updating the kernel, the previous version may get added to
version=() because extramodules also triggers when removed. To avoid
errors such as:
Failed to open kernel image file '/usr/lib/modules/7.0.0-1-cachyos/vmlinuz': No such file or directory
Check for existence of vmlinuz, and skip if it is not found.
Signed-off-by: Eric Naim <dnaim@cachyos.org>
This makes sure that kernel-install remove gets to run before all the kernel files are removed. Signed-off-by: Eric Naim <dnaim@cachyos.org>
Signed-off-by: Eric Naim <dnaim@cachyos.org>
|
Doesn't not running remove on upgrades leave old versions lying around? Running everything PostTransaction reduces the chance of an unbootable system due to a failed upgrade. The current logic only works with pacman-owned files. Running kernel-install's own install all command means installing every kernel, not just the ones owned by pacman. Also, isn't remove always followed by add during upgrades? Did you really run into a situation where this didn't happen? |
It doesn't. I don't have any orphaned files lying around both in /boot and /lib/modules. My guess here is that Upgrade implies Remove, but I'll have to double check that for confirmation.
Right, I made it a PreTransaction because of the continue line I made where it would skip
OK, I'll revert that change. I don't use any non-pacman owned kernels so I didn't consider that.
Can you elaborate more? I did run into a situation where something updated and I was left with no boot entries because |
|
Running PreTransaction and PostTransaction is probably fine, as that is what mkinitcpio does. In fact it is probably better to make this as similar as possible to mkinitcpio. At the same time there are differences, because kernel-install has versioned output paths, but mkinitcpio has the same output path for all versions. |
I've been using this for a while and noticed some weird behaviours, so I went ahead and tried to make it inline with how other similar hooks are behaving. I've been running these for a while now, so they should be stable.
P.S. I only updated the pkgrel here, but with how the fixes are looking, maybe a version bump is better.