Arch Linux and DKMS

I am not sure if anyone else has had this problem but lately when the kernel for Arch Linux is updated the DKMS fails to notice the new kernel and tried to install the modules for the old (now removed) kernel. I ended up with a short script to run against my computer before I reboot to get the proper modules installed so nothing fails.

#!/bin/bash

# Gets kernel from command line or attempts the currently booted kernel
kernel=${1:-"${uname -r)"}

# Gets the list of modules from DKMS and output in the form "module/module-version".
# DKMS shows "installed" when the module is compiled and installed for the current 
# kernel; it shows "added" when the module is NOT compiled and installed.
# You can also use cut, awk, and sed pipped together but I find this one to be better.
module_list=${dkms status | awk ' \
    BEGIN {FS="[,:]"} \
    { \
        if ( $0 ~ /added/ ) { \
            gsub(/^[[:space:]]+|[[:space:]]+$/,"",$2); \
            print $1"/"$2; \
        }
    }')

# Installs using dkms for each module
for m in $module_list ; do
    $(sudo dkms install -m $m -k $kernel)
done
Jesse Spangenberger

Jesse Spangenberger