vagrant-vbguest 0.3.5 → 0.4.0
Sign up to get free protection for your applications and to get access to all the features.
- data/Readme.md +15 -1
- data/lib/vagrant-vbguest/config.rb +31 -11
- data/lib/vagrant-vbguest/installer.rb +24 -24
- data/lib/vagrant-vbguest/middleware.rb +0 -1
- data/lib/vagrant-vbguest/version.rb +1 -1
- metadata +2 -2
data/Readme.md
CHANGED
@@ -52,6 +52,19 @@ vbguest will try to autodetect the best option for your system. WTF? see below.
|
|
52
52
|
* `no_install` (Boolean, default: `false`) : Whether to check the correct additions version only. This will warn you about version mis-matches, but will not try to install anything.
|
53
53
|
* `no_remote` (Boolean, default: `false`) : Whether to _not_ download the iso file from a remote location. This includes any `http` location!
|
54
54
|
|
55
|
+
#### Global Configuration
|
56
|
+
|
57
|
+
Using [Vagrantfile Load Order](http://vagrantup.com/v1/docs/vagrantfile.html#vagrantfile_load_order) you may change default configuration values.
|
58
|
+
Edit (create, if missing) your `~/.vagrant.d/Vagrantfile` like this:
|
59
|
+
|
60
|
+
```ruby
|
61
|
+
# vagrant's autoloading may not have kicked in
|
62
|
+
require 'vagrant-vbguest' unless defined? VagrantVbguest::Config
|
63
|
+
VagrantVbguest::Config.auto_update = false
|
64
|
+
```
|
65
|
+
|
66
|
+
Settings in a project's `Vagrantfile` will overwrite those setting. When executed as a command, command line arguments will overwrite all of the above.
|
67
|
+
|
55
68
|
|
56
69
|
### Running as a middleware
|
57
70
|
|
@@ -153,4 +166,5 @@ Those places will be checked in order:
|
|
153
166
|
|
154
167
|
* The installer script, which mounts and runs the GuestAdditions Installer Binary, works on linux only. Most likely it will run on most unix-like plattform.
|
155
168
|
* The installer script requires a directory `/mnt` on the guest system
|
156
|
-
* On multi vm boxes, the iso file will be downloaded for each vm
|
169
|
+
* On multi vm boxes, the iso file will be downloaded for each vm
|
170
|
+
* The plugin installation on Windows host systems my not work as expected (using `vagrant gem install vagrant-vbguest`). Try `C:\vagrant\vagrant\embedded\bin\gem.bat install vagrant-vbguest` instead. (See issue #5)
|
@@ -1,15 +1,35 @@
|
|
1
1
|
module VagrantVbguest
|
2
|
-
|
2
|
+
|
3
3
|
class Config < Vagrant::Config::Base
|
4
|
-
|
5
|
-
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
4
|
+
|
5
|
+
module Attributes
|
6
|
+
attr_accessor :iso_path, :auto_update, :no_install, :no_remote
|
7
|
+
end
|
8
|
+
|
9
|
+
class << self
|
10
|
+
include Attributes
|
11
|
+
|
12
|
+
def auto_update; @auto_update.nil? ? true : @auto_update end
|
13
|
+
def no_install; @no_install.nil? ? false : @no_install end
|
14
|
+
def no_remote; @no_remote.nil? ? false : @no_remote end
|
15
|
+
|
16
|
+
def iso_path
|
17
|
+
return nil if !@iso_path || @iso_path == :auto
|
18
|
+
@iso_path
|
19
|
+
end
|
20
|
+
end
|
21
|
+
|
22
|
+
include Attributes
|
23
|
+
|
24
|
+
def auto_update; @auto_update.nil? ? self.class.auto_update : @auto_update end
|
25
|
+
def no_install; @no_install.nil? ? self.class.no_install : @no_install end
|
26
|
+
def no_remote; @no_remote.nil? ? self.class.no_remote : @no_remote end
|
27
|
+
|
28
|
+
def iso_path
|
29
|
+
return self.class.iso_path if !@iso_path || @iso_path == :auto
|
30
|
+
@iso_path
|
31
|
+
end
|
32
|
+
|
13
33
|
# explicit hash, to get symbols in hash keys
|
14
34
|
def to_hash
|
15
35
|
{
|
@@ -19,6 +39,6 @@ module VagrantVbguest
|
|
19
39
|
:no_remote => no_remote
|
20
40
|
}
|
21
41
|
end
|
22
|
-
|
42
|
+
|
23
43
|
end
|
24
44
|
end
|
@@ -20,41 +20,41 @@ module VagrantVbguest
|
|
20
20
|
end
|
21
21
|
|
22
22
|
def run
|
23
|
+
|
24
|
+
return unless @options[:auto_update]
|
25
|
+
|
23
26
|
raise Vagrant::Errors::VMNotCreatedError if !@vm.created?
|
24
27
|
raise Vagrant::Errors::VMInaccessible if !@vm.state == :inaccessible
|
25
28
|
raise Vagrant::Errors::VMNotRunningError if @vm.state != :running
|
26
29
|
|
27
|
-
|
28
|
-
|
29
|
-
@vm.ui.success(I18n.t("vagrant.plugins.vbguest.guest_ok", :version => guest_version)) unless needs_update?
|
30
|
-
@vm.ui.warn(I18n.t("vagrant.plugins.vbguest.check_failed", :host => vb_version, :guest => guest_version)) if @options[:no_install]
|
30
|
+
@vm.ui.success(I18n.t("vagrant.plugins.vbguest.guest_ok", :version => guest_version)) unless needs_update?
|
31
|
+
@vm.ui.warn(I18n.t("vagrant.plugins.vbguest.check_failed", :host => vb_version, :guest => guest_version)) if @options[:no_install]
|
31
32
|
|
32
|
-
|
33
|
-
|
33
|
+
if @options[:force] || (!@options[:no_install] && needs_update?)
|
34
|
+
@vm.ui.warn(I18n.t("vagrant.plugins.vbguest.installing#{@options[:force] ? '_forced' : ''}", :host => vb_version, :guest => guest_version))
|
34
35
|
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
36
|
+
# :TODO:
|
37
|
+
# the whole installation process should be put into own classes
|
38
|
+
# like the vagrant system loading
|
39
|
+
if (i_script = installer_script)
|
40
|
+
@options[:iso_path] ||= VagrantVbguest::Detector.new(@vm, @options).iso_path
|
40
41
|
|
41
|
-
|
42
|
-
|
42
|
+
@vm.ui.info(I18n.t("vagrant.plugins.vbguest.start_copy_iso", :from => iso_path, :to => iso_destination))
|
43
|
+
@vm.channel.upload(iso_path, iso_destination)
|
43
44
|
|
44
|
-
|
45
|
-
|
45
|
+
@vm.ui.info(I18n.t("vagrant.plugins.vbguest.start_copy_script", :from => File.basename(i_script), :to => installer_destination))
|
46
|
+
@vm.channel.upload(i_script, installer_destination)
|
46
47
|
|
47
|
-
|
48
|
-
|
49
|
-
|
48
|
+
@vm.channel.sudo("chmod 0755 #{installer_destination}") do |type, data|
|
49
|
+
@vm.ui.info(data, :prefix => false, :new_line => false)
|
50
|
+
end
|
50
51
|
|
51
|
-
|
52
|
-
|
53
|
-
|
52
|
+
@vm.channel.sudo("#{installer_destination}") do |type, data|
|
53
|
+
@vm.ui.info(data, :prefix => false, :new_line => false)
|
54
|
+
end
|
54
55
|
|
55
|
-
|
56
|
-
|
57
|
-
end
|
56
|
+
@vm.channel.execute("rm #{installer_destination} #{iso_destination}") do |type, data|
|
57
|
+
@vm.ui.error(data.chomp, :prefix => false)
|
58
58
|
end
|
59
59
|
end
|
60
60
|
end
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: vagrant-vbguest
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.4.0
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2012-
|
12
|
+
date: 2012-10-21 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: bundler
|