From 3b3a2f4422357ab41b271663f742766bb62fc25f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B6rg=20Thalheim?= Date: Sat, 9 Jan 2016 10:09:54 +0000 Subject: [PATCH] add dkms-update script for kernel --- dkms-update | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100755 dkms-update 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