FS#49318 - [kmod] Pacman hook to update module dependencies
Attached to Project:
Arch Linux
Opened by Lachlan (padfoot) - Friday, 13 May 2016, 09:33 GMT
Last edited by Eli Schwartz (eschwartz) - Thursday, 11 January 2018, 03:35 GMT
Opened by Lachlan (padfoot) - Friday, 13 May 2016, 09:33 GMT
Last edited by Eli Schwartz (eschwartz) - Thursday, 11 January 2018, 03:35 GMT
|
Details
Description:
Feature request for a pacman hook to update module dependencies when an out of tree kernel module is installed/updated/removed. Additional info: I maintain an out of tree kernel module in the AUR, nvidiabl, and was looking at replacing the .install file with a pacman hook. The .install file calls depmod $(uname -r) on install, update and removal of the module. I am thinking a hook calling depmod would be more appropriate for the kmod package so other out of tree modules may benefit from it. I have included a sample hook below to be installed in /usr/share/libalpm/hooks Appreciate your consideration. Lachlan. [Trigger] Type = File Operation = Install Operation = Upgrade Operation = Remove Target = usr/lib/modules/*/ [Action] Description = Updating kernel module dependencies... When = PostTransaction Exec = /usr/bin/depmod $(uname -r) NeedsTargets |
This task depends upon
Closed by Eli Schwartz (eschwartz)
Thursday, 11 January 2018, 03:35 GMT
Reason for closing: Implemented
Additional comments about closing: We now use pacman hooks provided by the kernel package itself to run depmod.
Thursday, 11 January 2018, 03:35 GMT
Reason for closing: Implemented
Additional comments about closing: We now use pacman hooks provided by the kernel package itself to run depmod.
Thanks.
1) Figure out which kernel versions are affected by inspecting the list of files passed to the hook
2) Call depmod for each kernel version
In shell, this might look something like:
```
declare -A kernels
while IFS= read -r file; do
read -r kver _ < <(modinfo -F vermagic "$file" 2>/dev/null)
[[ $kver ]] && kernels["$kver"]=1
done
for kver in "${!kernels[@]}"; do
depmod "$kver"
done
```
But this doesn't work for removal since the files will be gone... It's impossible to derive this directly from the path because it may not contain the kernel version, e.g. nvidia's modules are under /usr/lib/modules/extramodules-4.5-ARCH but might have a version of 4.5.4-1-ARCH).
This seems like a pretty reasonable solution to me.