diff --git a/dkms-update b/dkms-update new file mode 100755 index 0000000..e226559 --- /dev/null +++ b/dkms-update @@ -0,0 +1,23 @@ +#!/usr/bin/env ruby + +kernel_package = ARGV[0] || "linux" + +content = "" +IO.popen(["pacman", "-Ql", kernel_package]) {|io| content = io.read } +kernel = /\/usr\/lib\/modules\/(?.*)\/kernel/.match(content) +abort "no kernel version found in package" unless kernel + +mods = Dir["/usr/src/*"].sort +mods.each do |mod| + match = /(?[^\/-]+)-(?.+)$/.match(mod) + unless match + puts "Skip module '#{mod}' (not following the name standard)" + next + end + args = ["dkms", + "install", + "-m", "#{match[:name]}/#{match[:version]}", + "-k", kernel[:version]] + puts "$ #{args.join(" ")}" + system(*args) +end