class VagrantVbguest::Installers::Debian
Public Class Methods
match?(vm)
click to toggle source
# File lib/vagrant-vbguest/installers/debian.rb, line 5 def self.match?(vm) /\Adebian\d*\Z/ =~ self.distro(vm) end
Public Instance Methods
install(opts=nil, &block)
click to toggle source
installs the correct linux-headers package installs ‘dkms` package for dynamic kernel module loading @param opts [Hash] Optional options Hash which might get passed to {Vagrant::Communication::SSH#execute} and friends @yield [type, data] Takes a Block like {Vagrant::Communication::Base#execute} for realtime output of the command being executed @yieldparam [String] type Type of the output, `:stdout`, `:stderr`, etc. @yieldparam [String] data Data for the given output.
Calls superclass method
# File lib/vagrant-vbguest/installers/debian.rb, line 15 def install(opts=nil, &block) begin communicate.sudo(install_dependencies_cmd, opts, &block) rescue communicate.sudo('apt-get -y --force-yes update', (opts || {}).merge(:error_check => false), &block) communicate.sudo(install_dependencies_cmd, opts, &block) end super end
Protected Instance Methods
dependencies()
click to toggle source
# File lib/vagrant-vbguest/installers/debian.rb, line 30 def dependencies # In case of PVE kernel, kernel modules and headers prefix is pve and not linux, so we need to check that. packages = if communicate.test('uname -r | grep pve') ['pve-headers-`uname -r`'] else ['linux-headers-`uname -r`'] end # include build-essential so we can compile the kernel modules. packages << 'build-essential' # some Debian system (lenny) don't come with a dkms package so we need to skip that. # apt-cache search will exit with 0 even if nothing was found, so we need to grep. packages << 'dkms' if communicate.test('apt-cache search --names-only \'^dkms$\' | grep dkms') packages.join ' ' end
install_dependencies_cmd()
click to toggle source
# File lib/vagrant-vbguest/installers/debian.rb, line 26 def install_dependencies_cmd "DEBIAN_FRONTEND=noninteractive apt-get install -y #{dependencies}" end