Sha256: 20941323a08800a227c6a5ac30b92d8954029b2dc60ed0f1b03b912bb4346c59

Contents?: true

Size: 1.35 KB

Versions: 1

Compression:

Stored size: 1.35 KB

Contents

module VagrantVbguest
  module Installers
    class Debian < Linux

      def self.match?(vm)
        :debian == self.distro(vm)
      end

      # installes the correct linux-headers package
      # installes `dkms` package for dynamic kernel module loading
      def install(opts=nil, &block)
        begin
          vm.channel.sudo(install_dependencies_cmd, opts, &block)
        rescue
          vm.channel.sudo('apt-get update', opts, &block)
          vm.channel.sudo(install_dependencies_cmd, opts, &block)
        end
        upload(iso_file)
        vm.channel.sudo("mount #{tmp_path} -o loop #{mount_point}", opts, &block)
        vm.channel.sudo("#{mount_point}/VBoxLinuxAdditions.run --nox11", opts, &block)
        vm.channel.sudo("umount #{mount_point}", opts, &block)
      end

    protected
      def install_dependencies_cmd
        "apt-get install -y #{dependencies}"
      end

      def dependencies
        packages = ['linux-headers-`uname -r`']
        # some Debian system (lenny) dont come with a dkms packe so we neet to skip that.
        # apt-cache search will exit with 0 even if nothing was found, so we need to grep.
        packages << 'dkmx' if vm.channel.test('apt-cache search --names-only \'^dkms$\' | grep dkms')
        packages.join ' '
      end
    end
  end
end
VagrantVbguest::Installer.register(VagrantVbguest::Installers::Debian, 5)

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
vagrant-vbguest-0.6.0.pre1 lib/vagrant-vbguest/installers/debian.rb