Skip to content
Snippets Groups Projects
Commit 18344572 authored by Markus Reiter's avatar Markus Reiter
Browse files

Remove kernel extensions specified in `uninstall :kext`.

parent 7853406f
No related branches found
No related tags found
No related merge requests found
......@@ -187,6 +187,10 @@ module Hbc
@command.run!("/sbin/kextunload", args: ["-b", kext], sudo: true)
sleep 1
end
@command.run!("/usr/sbin/kextfind", args: ["-b", kext], sudo: true).stdout.chomp.lines.each do |kext_path|
ohai "Removing kernel extension #{kext_path}"
@command.run!("/bin/rm", args: ["-rf", kext_path], sudo: true)
end
end
end
......
......@@ -192,6 +192,14 @@ describe Hbc::Artifact::Uninstall do
sudo(%W[/sbin/kextunload -b #{kext_id}])
)
Hbc::FakeSystemCommand.expects_command(
sudo(%W[/usr/sbin/kextfind -b #{kext_id}]), "/Library/Extensions/FancyPackage.kext\n"
)
Hbc::FakeSystemCommand.expects_command(
sudo(["/bin/rm", "-rf", "/Library/Extensions/FancyPackage.kext"])
)
subject
end
end
......
......@@ -193,6 +193,14 @@ describe Hbc::Artifact::Zap do
sudo(%W[/sbin/kextunload -b #{kext_id}])
)
Hbc::FakeSystemCommand.expects_command(
sudo(%W[/usr/sbin/kextfind -b #{kext_id}]), "/Library/Extensions/FancyPackage.kext\n"
)
Hbc::FakeSystemCommand.expects_command(
sudo(["/bin/rm", "-rf", "/Library/Extensions/FancyPackage.kext"])
)
subject
end
end
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment