add dkms-update script for kernel
This commit is contained in:
parent
c2801b8fc7
commit
3b3a2f4422
23
dkms-update
Executable file
23
dkms-update
Executable file
@ -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\/(?<version>.*)\/kernel/.match(content)
|
||||||
|
abort "no kernel version found in package" unless kernel
|
||||||
|
|
||||||
|
mods = Dir["/usr/src/*"].sort
|
||||||
|
mods.each do |mod|
|
||||||
|
match = /(?<name>[^\/-]+)-(?<version>.+)$/.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
|
Loading…
Reference in New Issue
Block a user