vagrant-vbguest 0.2.1 → 0.3.0.pre
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- data/lib/vagrant-vbguest.rb +2 -0
- data/lib/vagrant-vbguest/command.rb +2 -2
- data/lib/vagrant-vbguest/config.rb +1 -36
- data/lib/vagrant-vbguest/detector.rb +42 -0
- data/lib/vagrant-vbguest/errors.rb +14 -0
- data/lib/vagrant-vbguest/installer.rb +5 -1
- data/lib/vagrant-vbguest/version.rb +1 -1
- data/locales/en.yml +14 -6
- data/vagrant-vbguest.gemspec +0 -1
- metadata +9 -18
data/lib/vagrant-vbguest.rb
CHANGED
@@ -4,7 +4,7 @@ module VagrantVbguest
|
|
4
4
|
|
5
5
|
class Command < Vagrant::Command::Base
|
6
6
|
|
7
|
-
#
|
7
|
+
# Runs the vbguest installer on the VMs that are represented
|
8
8
|
# by this environment.
|
9
9
|
def execute
|
10
10
|
options = {}
|
@@ -46,7 +46,7 @@ module VagrantVbguest
|
|
46
46
|
|
47
47
|
# Executes a command on a specific VM.
|
48
48
|
def execute_on_vm(vm, options)
|
49
|
-
options
|
49
|
+
options = vm.config.vbguest.to_hash.merge(options)
|
50
50
|
VagrantVbguest::Installer.new(vm, options).run!
|
51
51
|
end
|
52
52
|
end
|
@@ -1,5 +1,3 @@
|
|
1
|
-
require 'virtualbox'
|
2
|
-
|
3
1
|
module VagrantVbguest
|
4
2
|
|
5
3
|
class Config < Vagrant::Config::Base
|
@@ -8,15 +6,10 @@ module VagrantVbguest
|
|
8
6
|
attr_accessor :no_install
|
9
7
|
attr_accessor :no_remote
|
10
8
|
|
11
|
-
def iso_path; @iso_path ||= autodetect_iso; end
|
12
9
|
def auto_update; @auto_update.nil? ? (@auto_update = true) : @auto_update; end
|
13
10
|
def no_remote; @no_remote.nil? ? (@no_remote = false) : @no_remote; end
|
14
11
|
def no_install; @no_install.nil? ? (@no_install = false): @no_install; end
|
15
|
-
|
16
|
-
def validate(env, errors)
|
17
|
-
errors.add(I18n.t("vagrant.plugins.vbguest.missing_iso_path")) unless iso_path && iso_path.is_a?(String)
|
18
|
-
end
|
19
|
-
|
12
|
+
|
20
13
|
# explicit hash, to get symbols in hash keys
|
21
14
|
def to_hash
|
22
15
|
{
|
@@ -27,33 +20,5 @@ module VagrantVbguest
|
|
27
20
|
}
|
28
21
|
end
|
29
22
|
|
30
|
-
protected
|
31
|
-
|
32
|
-
def autodetect_iso
|
33
|
-
media_manager_iso || guess_iso || web_iso
|
34
|
-
end
|
35
|
-
|
36
|
-
def media_manager_iso
|
37
|
-
dvd = VirtualBox::DVD.all.find do |d|
|
38
|
-
!!(d.location =~ /VBoxGuestAdditions.iso$/)
|
39
|
-
end
|
40
|
-
dvd ? dvd.location : nil
|
41
|
-
end
|
42
|
-
|
43
|
-
def guess_iso
|
44
|
-
path_platform = if Vagrant::Util::Platform.linux?
|
45
|
-
"/usr/share/virtualbox/VBoxGuestAdditions.iso"
|
46
|
-
elsif Vagrant::Util::Platform.darwin?
|
47
|
-
"/Applications/VirtualBox.app/Contents/MacOS/VBoxGuestAdditions.iso"
|
48
|
-
elsif Vagrant::Util::Platform.windows?
|
49
|
-
File.join((ENV["PROGRAM_FILES"] || ENV["PROGRAMFILES"]), "/Oracle/VirtualBox/VBoxGuestAdditions.iso")
|
50
|
-
end
|
51
|
-
File.exists?(path_platform) ? path_platform : nil
|
52
|
-
end
|
53
|
-
|
54
|
-
def web_iso
|
55
|
-
"http://download.virtualbox.org/virtualbox/$VBOX_VERSION/VBoxGuestAdditions_$VBOX_VERSION.iso" unless !no_remote
|
56
|
-
end
|
57
|
-
|
58
23
|
end
|
59
24
|
end
|
@@ -0,0 +1,42 @@
|
|
1
|
+
module VagrantVbguest
|
2
|
+
|
3
|
+
class Detector
|
4
|
+
|
5
|
+
def initialize(vm, options)
|
6
|
+
@vm = vm
|
7
|
+
@options = options
|
8
|
+
end
|
9
|
+
|
10
|
+
def iso_path
|
11
|
+
@iso_path ||= autodetect_iso
|
12
|
+
end
|
13
|
+
|
14
|
+
private
|
15
|
+
|
16
|
+
def autodetect_iso
|
17
|
+
path = media_manager_iso || guess_iso || web_iso
|
18
|
+
raise VagrantVbguest::IsoPathAutodetectionError if !path || path.empty?
|
19
|
+
path
|
20
|
+
end
|
21
|
+
|
22
|
+
def media_manager_iso
|
23
|
+
(m = @vm.driver.execute('list', 'dvds').match(/^.+:\s+(?<path>.*VBoxGuestAdditions.iso)$/i)) && m[:path]
|
24
|
+
end
|
25
|
+
|
26
|
+
def guess_iso
|
27
|
+
path_platform = if Vagrant::Util::Platform.linux?
|
28
|
+
"/usr/share/virtualbox/VBoxGuestAdditions.iso"
|
29
|
+
elsif Vagrant::Util::Platform.darwin?
|
30
|
+
"/Applications/VirtualBox.app/Contents/MacOS/VBoxGuestAdditions.iso"
|
31
|
+
elsif Vagrant::Util::Platform.windows?
|
32
|
+
File.join((ENV["PROGRAM_FILES"] || ENV["PROGRAMFILES"]), "/Oracle/VirtualBox/VBoxGuestAdditions.iso")
|
33
|
+
end
|
34
|
+
File.exists?(path_platform) ? path_platform : nil
|
35
|
+
end
|
36
|
+
|
37
|
+
def web_iso
|
38
|
+
"http://download.virtualbox.org/virtualbox/$VBOX_VERSION/VBoxGuestAdditions_$VBOX_VERSION.iso" unless @options[:no_remote]
|
39
|
+
end
|
40
|
+
|
41
|
+
end
|
42
|
+
end
|
@@ -0,0 +1,14 @@
|
|
1
|
+
module VagrantVbguest
|
2
|
+
|
3
|
+
class VbguestError < Vagrant::Errors::VagrantError
|
4
|
+
def error_namespace; "vagrant.plugins.vbguest.errors"; end
|
5
|
+
end
|
6
|
+
|
7
|
+
class IsoPathAutodetectionError < VagrantVbguest::VbguestError
|
8
|
+
error_key :autodetect_iso_path
|
9
|
+
end
|
10
|
+
|
11
|
+
class DownloadingDisabledError < VagrantVbguest::VbguestError
|
12
|
+
error_key :downloading_disabled
|
13
|
+
end
|
14
|
+
end
|
@@ -10,8 +10,8 @@ module VagrantVbguest
|
|
10
10
|
:tmp_path => vm.env.tmp_path
|
11
11
|
}
|
12
12
|
@vm = vm
|
13
|
-
@options = options
|
14
13
|
@iso_path = nil
|
14
|
+
@options = options
|
15
15
|
end
|
16
16
|
|
17
17
|
def run!
|
@@ -36,6 +36,8 @@ module VagrantVbguest
|
|
36
36
|
# the whole installation process should be put into own classes
|
37
37
|
# like the vagrant system loading
|
38
38
|
if (i_script = installer_script)
|
39
|
+
@options[:iso_path] ||= VagrantVbguest::Detector.new(@vm, @options).iso_path
|
40
|
+
|
39
41
|
@vm.ui.info(I18n.t("vagrant.plugins.vbguest.start_copy_iso", :from => iso_path, :to => iso_destination))
|
40
42
|
@vm.channel.upload(iso_path, iso_destination)
|
41
43
|
|
@@ -98,6 +100,8 @@ module VagrantVbguest
|
|
98
100
|
if local_iso?
|
99
101
|
@env[:iso_url]
|
100
102
|
else
|
103
|
+
# :TODO: This will also raise, if the iso_url points to an invalid local path
|
104
|
+
raise VagrantVbguest::DownloadingDisabledError.new(:from => @env[:iso_url]) if @options[:no_remote]
|
101
105
|
@download = VagrantVbguest::Download.new(@env)
|
102
106
|
@download.download
|
103
107
|
@download.temp_path
|
data/locales/en.yml
CHANGED
@@ -10,14 +10,22 @@ en:
|
|
10
10
|
start_copy_script: "Copy installer file %{from} into the box %{to}"
|
11
11
|
no_install_script_for_platform: "Sorry, don't know how to install on a %{platform} system. Stopping installation."
|
12
12
|
generic_install_script_for_platform: "%{platform} is currently not supported, will try generic Linux method..."
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
Could not autodetect
|
17
|
-
|
18
|
-
|
13
|
+
|
14
|
+
errors:
|
15
|
+
autodetect_iso_path: |-
|
16
|
+
Could not autodetect a local of the Virtualbox Guest Additions iso file.
|
17
|
+
Please configure a local path to the iso using `config.vbguest.iso_path`
|
18
|
+
in your Vagrantfile or the `--iso` command line option.
|
19
|
+
If you think this is a bug and vbguest could have guessed the iso_path,
|
19
20
|
please file a bug: https://github.com/dotless-de/vagrant-vbguest/issues
|
20
21
|
|
22
|
+
downloading_disabled: |-
|
23
|
+
Could not locate a local Virtualbox Guest Additions iso file.
|
24
|
+
However, the no_remote option was set and thus I will downlownload it from
|
25
|
+
%{from}
|
26
|
+
Please configure a local path to the iso using `config.vbguest.iso_path`
|
27
|
+
in your Vagrantfile or the `--iso` command line option.
|
28
|
+
|
21
29
|
download:
|
22
30
|
with: "Downloading VirtualBox Guest Additions ISO with %{class}..."
|
23
31
|
cleaning: "Cleaning up downloaded VirtualBox Guest Additions ISO..."
|
data/vagrant-vbguest.gemspec
CHANGED
@@ -20,7 +20,6 @@ Gem::Specification.new do |s|
|
|
20
20
|
# s.add_development_dependency "rspec"
|
21
21
|
# s.add_runtime_dependency "rest-client"
|
22
22
|
|
23
|
-
s.add_dependency "virtualbox", "~> 0.9.1"
|
24
23
|
s.add_dependency "vagrant", ">= 0.9.4"
|
25
24
|
s.add_development_dependency "bundler", ">= 1.0.0"
|
26
25
|
|
metadata
CHANGED
@@ -1,30 +1,19 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: vagrant-vbguest
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
5
|
-
prerelease:
|
4
|
+
version: 0.3.0.pre
|
5
|
+
prerelease: 6
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
8
8
|
- Robert Schulze
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2012-03
|
12
|
+
date: 2012-04-03 00:00:00.000000000Z
|
13
13
|
dependencies:
|
14
|
-
- !ruby/object:Gem::Dependency
|
15
|
-
name: virtualbox
|
16
|
-
requirement: &70316106858200 !ruby/object:Gem::Requirement
|
17
|
-
none: false
|
18
|
-
requirements:
|
19
|
-
- - ~>
|
20
|
-
- !ruby/object:Gem::Version
|
21
|
-
version: 0.9.1
|
22
|
-
type: :runtime
|
23
|
-
prerelease: false
|
24
|
-
version_requirements: *70316106858200
|
25
14
|
- !ruby/object:Gem::Dependency
|
26
15
|
name: vagrant
|
27
|
-
requirement: &
|
16
|
+
requirement: &70272787293680 !ruby/object:Gem::Requirement
|
28
17
|
none: false
|
29
18
|
requirements:
|
30
19
|
- - ! '>='
|
@@ -32,10 +21,10 @@ dependencies:
|
|
32
21
|
version: 0.9.4
|
33
22
|
type: :runtime
|
34
23
|
prerelease: false
|
35
|
-
version_requirements: *
|
24
|
+
version_requirements: *70272787293680
|
36
25
|
- !ruby/object:Gem::Dependency
|
37
26
|
name: bundler
|
38
|
-
requirement: &
|
27
|
+
requirement: &70272787293160 !ruby/object:Gem::Requirement
|
39
28
|
none: false
|
40
29
|
requirements:
|
41
30
|
- - ! '>='
|
@@ -43,7 +32,7 @@ dependencies:
|
|
43
32
|
version: 1.0.0
|
44
33
|
type: :development
|
45
34
|
prerelease: false
|
46
|
-
version_requirements: *
|
35
|
+
version_requirements: *70272787293160
|
47
36
|
description: A Vagrant plugin wich automatically installs the host's VirtualBox Guest
|
48
37
|
Additions on the guest system.
|
49
38
|
email:
|
@@ -62,7 +51,9 @@ files:
|
|
62
51
|
- lib/vagrant-vbguest.rb
|
63
52
|
- lib/vagrant-vbguest/command.rb
|
64
53
|
- lib/vagrant-vbguest/config.rb
|
54
|
+
- lib/vagrant-vbguest/detector.rb
|
65
55
|
- lib/vagrant-vbguest/download.rb
|
56
|
+
- lib/vagrant-vbguest/errors.rb
|
66
57
|
- lib/vagrant-vbguest/installer.rb
|
67
58
|
- lib/vagrant-vbguest/middleware.rb
|
68
59
|
- lib/vagrant-vbguest/version.rb
|