Sha256: ea7675abf01bef3a1d45c0fc29d0185311d2b242b7f093333611c8745bcb5ff5

Contents?: true

Size: 1.44 KB

Versions: 5

Compression:

Stored size: 1.44 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)

        installer = File.join(mount_point, 'VBoxLinuxAdditions.run')
        yield_installation_waring(installer)

        vm.channel.sudo("#{installer} --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 << 'dkms' 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

5 entries across 5 versions & 1 rubygems

Version Path
vagrant-vbguest-0.6.0.pre6 lib/vagrant-vbguest/installers/debian.rb
vagrant-vbguest-0.6.0.pre5 lib/vagrant-vbguest/installers/debian.rb
vagrant-vbguest-0.6.0.pre4 lib/vagrant-vbguest/installers/debian.rb
vagrant-vbguest-0.6.0.pre3 lib/vagrant-vbguest/installers/debian.rb
vagrant-vbguest-0.6.0.pre2 lib/vagrant-vbguest/installers/debian.rb