vagrant-vbguest 0.25.0 → 0.30.0
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.
- checksums.yaml +4 -4
- data/CHANGELOG.md +27 -2
- data/Gemfile +1 -1
- data/Readme.md +30 -0
- data/VERSION +1 -1
- data/lib/vagrant-vbguest.rb +20 -9
- data/lib/vagrant-vbguest/command.rb +1 -1
- data/lib/vagrant-vbguest/config.rb +6 -3
- data/lib/vagrant-vbguest/installer.rb +37 -7
- data/lib/vagrant-vbguest/installers/base.rb +15 -11
- data/lib/vagrant-vbguest/installers/centos.rb +22 -3
- data/lib/vagrant-vbguest/installers/linux.rb +27 -5
- data/lib/vagrant-vbguest/installers/redhat.rb +17 -2
- data/lib/vagrant-vbguest/installers/windows.rb +7 -1
- data/lib/vagrant-vbguest/middleware.rb +1 -1
- data/locales/en.yml +8 -0
- data/vagrant-vbguest.gemspec +2 -1
- metadata +4 -6
- data/.github/dependabot.yml +0 -13
- data/.github/stale.yml +0 -18
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: db28f68539ee8dda59a6f5c90d7af10f12a9d2c4dc7655d1bce7a9fc64a5c034
|
4
|
+
data.tar.gz: c2c9578e6654cf80c7294de848d4fd1463bc85eaef93407955da9d79b447c7a6
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3bb704473740a35f7b698ad0de4d7cc837c564589018670650f1c094d8d72c2b0832421eed554f07e3ad49a581b4d80d96f90a05ef2b472907ae8dc9ca736593
|
7
|
+
data.tar.gz: 77ccd750474b598241be1d29039ef09175dc66297ad5fdc866e2e47dcd1c3f0330138f0c20fbe220764b5988b3ec187bec94b69d2184b6618b1d28a13709038d
|
data/CHANGELOG.md
CHANGED
@@ -1,4 +1,29 @@
|
|
1
|
-
## 0.
|
1
|
+
## 0.30.0 (2021-06-05)
|
2
|
+
|
3
|
+
- Fix Ruby 3 compatibility [GH-409]
|
4
|
+
|
5
|
+
## 0.29.0 (2021-01-03)
|
6
|
+
|
7
|
+
- Add installer_option :enablerepo for CentOS. [GH-402], Fixes [GH-398]
|
8
|
+
- Add installer_option :running_kernel_modules for all Linux installers. [GH-403], Fixes [GH-396]
|
9
|
+
|
10
|
+
## 0.28.0 (2020-11-20)
|
11
|
+
|
12
|
+
- Work around a bug in vagrant 2.2.11 to 2.2.13, which would not load the vbguest middleware. [GH-394], Fixes [GH-391]
|
13
|
+
|
14
|
+
## 0.27.0 (2020-11-15)
|
15
|
+
|
16
|
+
- Un-mounting the guest additions iso will now take place in the cleanup step [GH-393]
|
17
|
+
- Running detection now checks for vboxguest and vboxsf kernel module. [GH-392], Fixes [GH-387]
|
18
|
+
|
19
|
+
## 0.26.0 (2020-10-30)
|
20
|
+
|
21
|
+
- Add a new configuration `installer_hooks` allows to configure arbitrary scripts to be run on the guest before/after installer steps are executed.
|
22
|
+
- Fix RHEL8 perl vs. perl-interpreter [GH-368]
|
23
|
+
- On RedHat, use `dnf` instead of `yum` if available. [GH-368]
|
24
|
+
- Fix incorrect re-use of installer_* options.
|
25
|
+
|
26
|
+
## 0.25.0 (2020-09-26)
|
2
27
|
|
3
28
|
- Renames mainline branch from "master" to "main"
|
4
29
|
- Fix not detecting running GuestAdditions on some systems [GH-347], [GH-376]. Thanks @Morac2 for [GH-377]
|
@@ -88,7 +113,7 @@ See discussion in [GH-300]. Thanks @cbj4074 for asking the right questions.
|
|
88
113
|
|
89
114
|
## 0.15.2 (2018-05-22)
|
90
115
|
|
91
|
-
- On
|
116
|
+
- On RedHat based guest, the installer will now try to install the 'kernel-devel' package additionally to 'kernel-devel-`uname -r`' Thanks @ghoneycutt [GH-299]
|
92
117
|
|
93
118
|
## 0.15.1 (2018-01-08)
|
94
119
|
|
data/Gemfile
CHANGED
@@ -9,7 +9,7 @@ group :development do
|
|
9
9
|
elsif ENV['VAGRANT_LOCAL']
|
10
10
|
gem 'vagrant', path: ENV['VAGRANT_LOCAL']
|
11
11
|
else
|
12
|
-
gem 'vagrant', :git => 'https://github.com/hashicorp/vagrant.git'
|
12
|
+
gem 'vagrant', :git => 'https://github.com/hashicorp/vagrant.git', branch: "main"
|
13
13
|
end
|
14
14
|
gem 'rake', '>= 12.3.3'
|
15
15
|
end
|
data/Readme.md
CHANGED
@@ -59,6 +59,7 @@ vbguest will try to autodetect the best option for your system. WTF? see below.
|
|
59
59
|
* `installer` (`VagrantVbguest::Installers::Base`, optional) : Reference to a (custom) installer class
|
60
60
|
* `installer_arguments` (Array, default: `['--nox11']`) : List of additional arguments to pass to the installer. eg: `%w{--nox11 --force}` would execute `VBoxLinuxAdditions.run install --nox11 --force`
|
61
61
|
* `installer_options` (Hash, default: `{}`) : Configure how a Installer internally works. Should be set on a `vm` level.
|
62
|
+
* `installer_hooks` (Hash, default: `{}`) : Configure scripts to be run before/after installer steps.
|
62
63
|
* `yes` (Boolean or String, default: `true`): Wheter to pipe `yes` to the installer. If `true`, executes `yes | VBoxLinuxAdditions.run install`. With `false`, the command is executed without `yes`. You can also put in a string here for `yes` (e.g. `no` to refuse all messages)
|
63
64
|
|
64
65
|
|
@@ -97,12 +98,21 @@ Vagrant.configure("2") do |config|
|
|
97
98
|
end
|
98
99
|
end
|
99
100
|
```
|
101
|
+
##### Linux
|
100
102
|
|
103
|
+
This option is available on all Linux type installers.
|
104
|
+
|
105
|
+
* `:running_kernel_modules` (default: `["vboxguest", "vboxsf"]`) The list used to check for the "running" state. Each of these modules need to appear at the beginning of a line in `/proc/modules`.
|
101
106
|
|
102
107
|
##### CentOS
|
103
108
|
|
104
109
|
* `:allow_kernel_upgrade` (default: `false`): If `true`, instead of trying to find matching the matching kernel-devel package to the installed kernel version, the kernel will be updated and the (now matching) up-to-date kernel-devel will be installed. __NOTE__: This will trigger a reboot of the box.
|
105
110
|
* `:reboot_timeout` (default: `300`): Maximum number of seconds to wait for the box to reboot after a kernel upgrade.
|
111
|
+
* `:enablerepo`: (default: `false`) Configure `yum --enablerepo` settings. Possible values are:
|
112
|
+
- Single String: `"C*-base"` converts to `--enablerepo=C*-base`
|
113
|
+
- Array of Strings: `['C*-base', 'C*-updates']` converts to `--enablerepo=C*-base --enablerepo=C*-updates`
|
114
|
+
- `true`: Enables `C${release_version}-base` and `C${release_version}-updates` with release_version read from `/etc/centos-release` if the repo exists, otherwise `*`.
|
115
|
+
- `false`: Does not set any `--enablerepo`
|
106
116
|
|
107
117
|
#### Global Configuration
|
108
118
|
|
@@ -128,6 +138,26 @@ VagrantVbguest::Config.auto_update = false
|
|
128
138
|
Settings in a project's `Vagrantfile` will overwrite those setting. When executed as a command, command line arguments will overwrite all of the above.
|
129
139
|
|
130
140
|
|
141
|
+
#### Installer Hooks (`installer_hooks`)
|
142
|
+
|
143
|
+
Additionally to the build-in `installer_options`, you can configure to execute scripts around the install steps `install`, `rebuild` and `start`.
|
144
|
+
Accepts either a single command or and array of commands. Box-specific settings overwrite earlier settings, just like with `installer_options`.
|
145
|
+
|
146
|
+
Use this make changes to the guest, for example to install specific dependencies or tweak the network setup.
|
147
|
+
|
148
|
+
* `before_install`/`after_install`: Runs before/after the install step. That is before uploading the iso file into the guest and after unmounting the iso file.
|
149
|
+
* `before_rebuild`/`after_rebuild`: Runs before/after the installer runs a command to let the GuestAdditions rebuild itself.
|
150
|
+
* `before_start`/`after_start`: Runs before/after the installer runs a command to start the GuestAdditions service.
|
151
|
+
|
152
|
+
```ruby
|
153
|
+
Vagrant.configure("2") do |config|
|
154
|
+
config.vm.define "my_cent_os_box" do |c|
|
155
|
+
c.vbguest.installer_hooks[:before_install] = ["yum install -y epel-release", "sleep 1"]
|
156
|
+
end
|
157
|
+
end
|
158
|
+
```
|
159
|
+
|
160
|
+
|
131
161
|
### Running as a middleware
|
132
162
|
|
133
163
|
Running as a middleware is the default way of using *vagrant-vbguest*.
|
data/VERSION
CHANGED
@@ -1 +1 @@
|
|
1
|
-
0.
|
1
|
+
0.30.0
|
data/lib/vagrant-vbguest.rb
CHANGED
@@ -31,8 +31,6 @@ require 'vagrant-vbguest/installers/suse'
|
|
31
31
|
require 'vagrant-vbguest/installers/archlinux'
|
32
32
|
require 'vagrant-vbguest/installers/windows'
|
33
33
|
|
34
|
-
require 'vagrant-vbguest/middleware'
|
35
|
-
|
36
34
|
module VagrantVbguest
|
37
35
|
|
38
36
|
class Plugin < Vagrant.plugin("2")
|
@@ -52,13 +50,26 @@ module VagrantVbguest
|
|
52
50
|
Command
|
53
51
|
end
|
54
52
|
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
53
|
+
if ("2.2.11".."2.2.13").include?(Gem::Version.create(Vagrant::VERSION).release.to_s)
|
54
|
+
$stderr.puts(
|
55
|
+
"Vagrant v#{Vagrant::VERSION} has a bug which prevents vagrant-vbguest to register probably.\n" \
|
56
|
+
"vagrant-vbguest will try to do the next best thing, but might not be working as expected.\n" \
|
57
|
+
"If possible, please upgrade Vagrant to >= 2.2.14"
|
58
|
+
)
|
59
|
+
action_hook('vbguest', :machine_action_up) do |hook|
|
60
|
+
require 'vagrant-vbguest/middleware'
|
61
|
+
hook.append(VagrantVbguest::Middleware)
|
62
|
+
end
|
63
|
+
else
|
64
|
+
# hook after anything that boots:
|
65
|
+
# that's all middlewares which will run the buildin "VM::Boot" action
|
66
|
+
action_hook('vbguest') do |hook|
|
67
|
+
require 'vagrant-vbguest/middleware'
|
68
|
+
if defined?(VagrantPlugins::ProviderVirtualBox::Action::CheckGuestAdditions)
|
69
|
+
hook.before(VagrantPlugins::ProviderVirtualBox::Action::CheckGuestAdditions, VagrantVbguest::Middleware)
|
70
|
+
else
|
71
|
+
hook.after(VagrantPlugins::ProviderVirtualBox::Action::Boot, VagrantVbguest::Middleware)
|
72
|
+
end
|
62
73
|
end
|
63
74
|
end
|
64
75
|
end
|
@@ -94,7 +94,7 @@ module VagrantVbguest
|
|
94
94
|
options = vm.config.vbguest.to_hash.merge(options)
|
95
95
|
machine = VagrantVbguest::Machine.new(vm, options)
|
96
96
|
status = machine.state
|
97
|
-
vm.env.ui.send((:ok == status ? :success : :warn), I18n.t("vagrant_vbguest.status.#{status}", machine.info))
|
97
|
+
vm.env.ui.send((:ok == status ? :success : :warn), I18n.t("vagrant_vbguest.status.#{status}", **machine.info))
|
98
98
|
|
99
99
|
if _method != :status
|
100
100
|
machine.send(_method)
|
@@ -5,7 +5,7 @@ module VagrantVbguest
|
|
5
5
|
module Attributes
|
6
6
|
attr_accessor :auto_update, :auto_reboot, :no_install, :no_remote,
|
7
7
|
:installer, :installer_arguments, :installer_options,
|
8
|
-
:allow_downgrade,
|
8
|
+
:installer_hooks, :allow_downgrade,
|
9
9
|
:iso_path, :iso_upload_path, :iso_mount_point, :yes
|
10
10
|
end
|
11
11
|
|
@@ -18,6 +18,7 @@ module VagrantVbguest
|
|
18
18
|
def no_remote; @no_remote.nil? ? false : @no_remote end
|
19
19
|
def installer_arguments; @installer_arguments.nil? ? '--nox11' : @installer_arguments end
|
20
20
|
def installer_options; @installer_options ||= {} end
|
21
|
+
def installer_hooks; @installer_hooks ||= {} end
|
21
22
|
def yes; @yes.nil? ? true : @yes end
|
22
23
|
|
23
24
|
def iso_path
|
@@ -34,8 +35,9 @@ module VagrantVbguest
|
|
34
35
|
def auto_reboot; @auto_reboot.nil? ? self.class.auto_reboot : @auto_reboot end
|
35
36
|
def no_install; @no_install.nil? ? self.class.no_install : @no_install end
|
36
37
|
def no_remote; @no_remote.nil? ? self.class.no_remote : @no_remote end
|
37
|
-
def installer_arguments; @installer_arguments.nil? ? self.class.installer_arguments : @installer_arguments end
|
38
|
-
def installer_options; @installer_options ||= self.class.installer_options end
|
38
|
+
def installer_arguments; @installer_arguments.nil? ? self.class.installer_arguments.dup : @installer_arguments end
|
39
|
+
def installer_options; @installer_options ||= self.class.installer_options.dup end
|
40
|
+
def installer_hooks; @installer_hooks ||= self.class.installer_hooks.dup end
|
39
41
|
def yes; @yes.nil? ? self.class.yes : @yes end
|
40
42
|
|
41
43
|
def iso_path
|
@@ -51,6 +53,7 @@ module VagrantVbguest
|
|
51
53
|
:installer => installer,
|
52
54
|
:installer_arguments => installer_arguments,
|
53
55
|
:installer_options => installer_options,
|
56
|
+
:installer_hooks => installer_hooks,
|
54
57
|
:iso_path => iso_path,
|
55
58
|
:iso_upload_path => iso_upload_path,
|
56
59
|
:iso_mount_point => iso_mount_point,
|
@@ -60,8 +60,10 @@ module VagrantVbguest
|
|
60
60
|
installer = guest_installer
|
61
61
|
raise NoInstallerFoundError, :method => 'install' if !installer
|
62
62
|
|
63
|
-
|
64
|
-
|
63
|
+
with_hooks(:install) do
|
64
|
+
installer.install do |type, data|
|
65
|
+
@env.ui.info(data, :prefix => false, :new_line => false)
|
66
|
+
end
|
65
67
|
end
|
66
68
|
ensure
|
67
69
|
cleanup
|
@@ -71,8 +73,10 @@ module VagrantVbguest
|
|
71
73
|
installer = guest_installer
|
72
74
|
raise NoInstallerFoundError, :method => 'rebuild' if !installer
|
73
75
|
|
74
|
-
|
75
|
-
|
76
|
+
with_hooks(:rebuild) do
|
77
|
+
installer.rebuild do |type, data|
|
78
|
+
@env.ui.info(data, :prefix => false, :new_line => false)
|
79
|
+
end
|
76
80
|
end
|
77
81
|
end
|
78
82
|
|
@@ -80,8 +84,10 @@ module VagrantVbguest
|
|
80
84
|
installer = guest_installer
|
81
85
|
raise NoInstallerFoundError, :method => 'manual start' if !installer
|
82
86
|
|
83
|
-
|
84
|
-
|
87
|
+
with_hooks(:start) do
|
88
|
+
installer.start do |type, data|
|
89
|
+
@env.ui.info(data, :prefix => false, :new_line => false)
|
90
|
+
end
|
85
91
|
end
|
86
92
|
end
|
87
93
|
|
@@ -145,8 +151,32 @@ module VagrantVbguest
|
|
145
151
|
end
|
146
152
|
|
147
153
|
def cleanup
|
148
|
-
|
154
|
+
return unless @guest_installer
|
155
|
+
|
156
|
+
@guest_installer.cleanup do |type, data|
|
157
|
+
@env.ui.info(data, :prefix => false, :new_line => false)
|
158
|
+
end
|
149
159
|
end
|
150
160
|
|
161
|
+
def with_hooks(step_name)
|
162
|
+
run_hook(:"before_#{step_name}")
|
163
|
+
ret = yield
|
164
|
+
run_hook(:"after_#{step_name}")
|
165
|
+
|
166
|
+
ret
|
167
|
+
end
|
168
|
+
|
169
|
+
def run_hook(hook_name)
|
170
|
+
hooks = @options.dig(:installer_hooks, hook_name)
|
171
|
+
|
172
|
+
return if !hooks || hooks.empty?
|
173
|
+
|
174
|
+
@vm.ui.info I18n.t("vagrant_vbguest.installer_hooks.#{hook_name}")
|
175
|
+
Array(hooks).each do |l|
|
176
|
+
@vm.communicate.sudo(l) do |type, data|
|
177
|
+
@env.ui.info(data, :prefix => false, :new_line => false)
|
178
|
+
end
|
179
|
+
end
|
180
|
+
end
|
151
181
|
end
|
152
182
|
end
|
@@ -189,16 +189,18 @@ module VagrantVbguest
|
|
189
189
|
# will start _now_.
|
190
190
|
# The message includes the host and installer version strings.
|
191
191
|
def yield_installation_warning(path_to_installer)
|
192
|
-
@env.ui.warn I18n.t(
|
193
|
-
:
|
194
|
-
:
|
192
|
+
@env.ui.warn I18n.t(
|
193
|
+
"vagrant_vbguest.installing#{@options[:force] ? '_forced' : ''}",
|
194
|
+
guest_version: (guest_version || I18n.t("vagrant_vbguest.unknown")),
|
195
|
+
installer_version: (installer_version(path_to_installer) || I18n.t("vagrant_vbguest.unknown")))
|
195
196
|
end
|
196
197
|
|
197
198
|
# Helper to yield a warning message to the user, that the installation
|
198
199
|
# will be rebuild using the installed GuestAdditions.
|
199
200
|
# The message includes the host and installer version strings.
|
200
201
|
def yield_rebuild_warning
|
201
|
-
@env.ui.warn I18n.t(
|
202
|
+
@env.ui.warn I18n.t(
|
203
|
+
"vagrant_vbguest.rebuild#{@options[:force] ? '_forced' : ''}",
|
202
204
|
:guest_version => guest_version(true),
|
203
205
|
:host_version => @host.version)
|
204
206
|
end
|
@@ -210,8 +212,9 @@ module VagrantVbguest
|
|
210
212
|
# knows there could be a problem. The message includles the installer
|
211
213
|
# version.
|
212
214
|
def yield_installation_error_warning(path_to_installer)
|
213
|
-
@env.ui.warn I18n.t(
|
214
|
-
|
215
|
+
@env.ui.warn I18n.t(
|
216
|
+
"vagrant_vbguest.install_error",
|
217
|
+
installer_version: (installer_version(path_to_installer) || I18n.t("vagrant_vbguest.unknown")))
|
215
218
|
end
|
216
219
|
# alias to old method name (containing a typo) for backwards compatibility
|
217
220
|
alias_method :yield_installation_waring, :yield_installation_error_warning
|
@@ -230,18 +233,19 @@ module VagrantVbguest
|
|
230
233
|
#
|
231
234
|
# @param file [String] Path of the file to upload to the +tmp_path*
|
232
235
|
def upload(file)
|
233
|
-
env.ui.info(I18n.t("vagrant_vbguest.start_copy_iso", :
|
236
|
+
env.ui.info(I18n.t("vagrant_vbguest.start_copy_iso", from: file, to: tmp_path))
|
234
237
|
communicate.upload(file, tmp_path)
|
235
238
|
end
|
236
239
|
|
237
240
|
# A helper method to delete the uploaded GuestAdditions iso file
|
238
241
|
# from the guest box
|
239
|
-
def cleanup
|
242
|
+
def cleanup(opts, &block)
|
240
243
|
unless options[:no_cleanup]
|
241
244
|
@host.cleanup
|
242
|
-
|
243
|
-
|
244
|
-
|
245
|
+
|
246
|
+
opts = (opts || {}).merge(:error_check => false)
|
247
|
+
block ||= proc { |type, data| env.ui.error(data.chomp, :prefix => false) }
|
248
|
+
communicate.execute("test -f #{tmp_path} && rm #{tmp_path}", opts, &block)
|
245
249
|
end
|
246
250
|
end
|
247
251
|
end
|
@@ -29,6 +29,26 @@ module VagrantVbguest
|
|
29
29
|
installer_options[:allow_kernel_upgrade]
|
30
30
|
end
|
31
31
|
|
32
|
+
# parse the installer_option :enablerepo
|
33
|
+
def enablerepo
|
34
|
+
unless instance_variable_defined?(:@enablerepo)
|
35
|
+
enablerepo = installer_options.fetch(:enablerepo, false)
|
36
|
+
@enablerepo =
|
37
|
+
case enablerepo
|
38
|
+
when String
|
39
|
+
"--enablerepo=#{enablerepo}"
|
40
|
+
when Array
|
41
|
+
enablerepo.map { |e| "--enablerepo=#{e}" }.join(" ")
|
42
|
+
when true
|
43
|
+
rel = has_rel_repo? ? release_version : '*'
|
44
|
+
"--enablerepo=C#{rel}-base --enablerepo=C#{rel}-updates"
|
45
|
+
else
|
46
|
+
nil
|
47
|
+
end
|
48
|
+
end
|
49
|
+
@enablerepo
|
50
|
+
end
|
51
|
+
|
32
52
|
def install_kernel_deps(opts=nil, &block)
|
33
53
|
unless has_kernel_devel_info?
|
34
54
|
update_release_repos(opts, &block)
|
@@ -46,7 +66,7 @@ module VagrantVbguest
|
|
46
66
|
def has_rel_repo?
|
47
67
|
unless instance_variable_defined?(:@has_rel_repo)
|
48
68
|
rel = release_version
|
49
|
-
@has_rel_repo = communicate.test(
|
69
|
+
@has_rel_repo = communicate.test("yum repolist --enablerepo=C#{rel}-base --enablerepo=C#{rel}-updates")
|
50
70
|
end
|
51
71
|
@has_rel_repo
|
52
72
|
end
|
@@ -68,8 +88,7 @@ module VagrantVbguest
|
|
68
88
|
end
|
69
89
|
|
70
90
|
def install_kernel_devel(opts=nil, &block)
|
71
|
-
|
72
|
-
cmd = 'yum install -y kernel-devel-`uname -r`'
|
91
|
+
cmd = "yum install -y kernel-devel-`uname -r` #{enablerepo}"
|
73
92
|
communicate.sudo(cmd, opts, &block)
|
74
93
|
end
|
75
94
|
|
@@ -67,7 +67,6 @@ module VagrantVbguest
|
|
67
67
|
mount_iso(opts, &block)
|
68
68
|
execute_installer(opts, &block)
|
69
69
|
start(opts, &block)
|
70
|
-
unmount_iso(opts, &block) unless options[:no_cleanup]
|
71
70
|
end
|
72
71
|
|
73
72
|
# @param opts [Hash] Optional options Hash wich meight get passed to {Vagrant::Communication::SSH#execute} and firends
|
@@ -75,10 +74,20 @@ module VagrantVbguest
|
|
75
74
|
# @yieldparam [String] type Type of the output, `:stdout`, `:stderr`, etc.
|
76
75
|
# @yieldparam [String] data Data for the given output.
|
77
76
|
def running?(opts=nil, &block)
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
77
|
+
kmods = nil
|
78
|
+
communicate.sudo('cat /proc/modules', opts) do |type, data|
|
79
|
+
block.call(type, data) if block
|
80
|
+
kmods = data if type == :stdout && data
|
81
|
+
end
|
82
|
+
|
83
|
+
unless kmods
|
84
|
+
env.ui.warn "Could not read /proc/modules"
|
85
|
+
return true
|
86
|
+
end
|
87
|
+
|
88
|
+
Array(installer_options[:running_kernel_modules]).all? do |mod|
|
89
|
+
/^#{mod}\b/i.match(kmods)
|
90
|
+
end
|
82
91
|
end
|
83
92
|
|
84
93
|
# This overrides {VagrantVbguest::Installers::Base#guest_version}
|
@@ -233,6 +242,12 @@ module VagrantVbguest
|
|
233
242
|
@installer_arguments ||= Array(options[:installer_arguments]).join " "
|
234
243
|
end
|
235
244
|
|
245
|
+
def installer_options
|
246
|
+
@installer_options ||= {
|
247
|
+
running_kernel_modules: ["vboxguest", "vboxsf"]
|
248
|
+
}.merge!(super)
|
249
|
+
end
|
250
|
+
|
236
251
|
# Determine if yes needs to be called or not
|
237
252
|
def yes
|
238
253
|
value = @options[:yes]
|
@@ -269,6 +284,13 @@ module VagrantVbguest
|
|
269
284
|
env.ui.info(I18n.t("vagrant_vbguest.unmounting_iso", :mount_point => mount_point))
|
270
285
|
communicate.sudo("umount #{mount_point}", opts, &block)
|
271
286
|
end
|
287
|
+
|
288
|
+
def cleanup(opts=nil, &block)
|
289
|
+
unless options[:no_cleanup]
|
290
|
+
unmount_iso(opts, &block)
|
291
|
+
super
|
292
|
+
end
|
293
|
+
end
|
272
294
|
end
|
273
295
|
end
|
274
296
|
end
|
@@ -16,7 +16,11 @@ module VagrantVbguest
|
|
16
16
|
|
17
17
|
protected
|
18
18
|
def install_dependencies_cmd
|
19
|
-
"
|
19
|
+
"#{package_manager_cmd} install -y #{dependencies}"
|
20
|
+
end
|
21
|
+
|
22
|
+
def package_manager_cmd
|
23
|
+
"`bash -c 'type -p dnf || type -p yum'`"
|
20
24
|
end
|
21
25
|
|
22
26
|
def dependencies
|
@@ -26,11 +30,22 @@ module VagrantVbguest
|
|
26
30
|
'gcc',
|
27
31
|
'binutils',
|
28
32
|
'make',
|
29
|
-
|
33
|
+
perl_dependency,
|
30
34
|
'bzip2',
|
31
35
|
'elfutils-libelf-devel'
|
32
36
|
].join(' ')
|
33
37
|
end
|
38
|
+
|
39
|
+
def perl_dependency
|
40
|
+
unless instance_variable_defined?(:@perl_dependency)
|
41
|
+
@perl_dependency = if communicate.test("#{package_manager_cmd} list perl-interpreter")
|
42
|
+
"perl-interpreter"
|
43
|
+
else
|
44
|
+
"perl"
|
45
|
+
end
|
46
|
+
end
|
47
|
+
@perl_dependency
|
48
|
+
end
|
34
49
|
end
|
35
50
|
end
|
36
51
|
end
|
@@ -51,7 +51,6 @@ module VagrantVbguest
|
|
51
51
|
upload(iso_file)
|
52
52
|
mount_iso(opts, &block)
|
53
53
|
execute_installer(opts, &block)
|
54
|
-
unmount_iso(opts, &block) unless options[:no_cleanup]
|
55
54
|
end
|
56
55
|
|
57
56
|
def reboot_after_install?(opts = nil, &block)
|
@@ -113,6 +112,13 @@ module VagrantVbguest
|
|
113
112
|
communicate.execute("Remove-Item -Path #{tmp_path}", opts, &block)
|
114
113
|
end
|
115
114
|
|
115
|
+
def cleanup(opts = nil, &block)
|
116
|
+
unless options[:no_cleanup]
|
117
|
+
unmount_iso(opts, &block)
|
118
|
+
super
|
119
|
+
end
|
120
|
+
end
|
121
|
+
|
116
122
|
def yield_installation_error_warning(path_to_installer)
|
117
123
|
@env.ui.warn I18n.t(
|
118
124
|
"vagrant_vbguest.windows.install_error",
|
@@ -21,7 +21,7 @@ module VagrantVbguest
|
|
21
21
|
if options[:auto_update]
|
22
22
|
machine = VagrantVbguest::Machine.new vm, options
|
23
23
|
status = machine.state
|
24
|
-
vm.env.ui.send((:ok == status ? :success : :warn), I18n.t("vagrant_vbguest.status.#{status}", machine.info))
|
24
|
+
vm.env.ui.send((:ok == status ? :success : :warn), I18n.t("vagrant_vbguest.status.#{status}", **machine.info))
|
25
25
|
machine.run
|
26
26
|
reboot(vm, options) if machine.reboot?
|
27
27
|
end
|
data/locales/en.yml
CHANGED
@@ -34,6 +34,14 @@ en:
|
|
34
34
|
ok: "[%{vm_name}] GuestAdditions %{guest_version} running --- OK."
|
35
35
|
skipped_downgrade: "GuestAdditions are newer than your host but, downgrades are disabled. Skipping."
|
36
36
|
|
37
|
+
installer_hooks:
|
38
|
+
before_install: "Executing pre-install hooks"
|
39
|
+
after_install: "Executing post-install hooks"
|
40
|
+
before_rebuild: "Executing pre-rebuild hooks"
|
41
|
+
after_rebuild: "Executing post-rebuild hooks"
|
42
|
+
before_start: "Executing pre-start hooks"
|
43
|
+
after_start: "Executing post-start hooks"
|
44
|
+
|
37
45
|
errors:
|
38
46
|
autodetect_iso_path: |-
|
39
47
|
Could not locate a local Virtualbox Guest Additions iso file.
|
data/vagrant-vbguest.gemspec
CHANGED
@@ -10,6 +10,7 @@ Gem::Specification.new do |s|
|
|
10
10
|
s.summary = %q{A Vagrant plugin to install the VirtualBoxAdditions into the guest VM}
|
11
11
|
s.description = %q{A Vagrant plugin which automatically installs the host's VirtualBox Guest Additions on the guest system.}
|
12
12
|
|
13
|
+
s.required_ruby_version = ">= 2.0"
|
13
14
|
s.required_rubygems_version = ">= 1.3.6"
|
14
15
|
|
15
16
|
s.add_dependency "micromachine", ">= 2", "< 4"
|
@@ -18,7 +19,7 @@ Gem::Specification.new do |s|
|
|
18
19
|
s.add_dependency "i18n"
|
19
20
|
s.add_dependency "log4r"
|
20
21
|
|
21
|
-
s.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features|testdrive)/}) }
|
22
|
+
s.files = `git ls-files -z`.split("\x0").reject { |f| f.match(%r{^(test|spec|features|testdrive|\.github)/}) }
|
22
23
|
s.bindir = "exe"
|
23
24
|
s.executables = s.files.grep(%r{^exe/}) { |f| File.basename(f) }
|
24
25
|
s.require_paths = ["lib"]
|
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: vagrant-vbguest
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.30.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Robert Schulze
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2021-06-05 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: micromachine
|
@@ -66,8 +66,6 @@ executables: []
|
|
66
66
|
extensions: []
|
67
67
|
extra_rdoc_files: []
|
68
68
|
files:
|
69
|
-
- ".github/dependabot.yml"
|
70
|
-
- ".github/stale.yml"
|
71
69
|
- ".gitignore"
|
72
70
|
- CHANGELOG.md
|
73
71
|
- CODE_OF_CONDUCT.md
|
@@ -123,14 +121,14 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
123
121
|
requirements:
|
124
122
|
- - ">="
|
125
123
|
- !ruby/object:Gem::Version
|
126
|
-
version: '0'
|
124
|
+
version: '2.0'
|
127
125
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
128
126
|
requirements:
|
129
127
|
- - ">="
|
130
128
|
- !ruby/object:Gem::Version
|
131
129
|
version: 1.3.6
|
132
130
|
requirements: []
|
133
|
-
rubygems_version: 3.
|
131
|
+
rubygems_version: 3.2.15
|
134
132
|
signing_key:
|
135
133
|
specification_version: 4
|
136
134
|
summary: A Vagrant plugin to install the VirtualBoxAdditions into the guest VM
|
data/.github/dependabot.yml
DELETED
@@ -1,13 +0,0 @@
|
|
1
|
-
# To get started with Dependabot version updates, you'll need to specify which
|
2
|
-
# package ecosystems to update and where the package manifests are located.
|
3
|
-
# Please see the documentation for all configuration options:
|
4
|
-
# https://help.github.com/github/administering-a-repository/configuration-options-for-dependency-updates
|
5
|
-
|
6
|
-
version: 2
|
7
|
-
updates:
|
8
|
-
- package-ecosystem: "bundler" # See documentation for possible values
|
9
|
-
directory: "/" # Location of package manifests
|
10
|
-
schedule:
|
11
|
-
interval: "daily"
|
12
|
-
ignore:
|
13
|
-
- dependency-name: "vagrant"
|
data/.github/stale.yml
DELETED
@@ -1,18 +0,0 @@
|
|
1
|
-
# Configuration for https://github.com/probot/stale
|
2
|
-
# Number of days of inactivity before an issue becomes stale
|
3
|
-
daysUntilStale: 60
|
4
|
-
# Number of days of inactivity before a stale issue is closed
|
5
|
-
daysUntilClose: 7
|
6
|
-
# Issues with these labels will never be considered stale
|
7
|
-
exemptLabels:
|
8
|
-
- pinned
|
9
|
-
- security
|
10
|
-
# Label to use when marking an issue as stale
|
11
|
-
staleLabel: wontfix
|
12
|
-
# Comment to post when marking an issue as stale. Set to `false` to disable
|
13
|
-
markComment: >
|
14
|
-
This issue has been automatically marked as stale because it has not had
|
15
|
-
recent activity. It will be closed if no further activity occurs. Thank you
|
16
|
-
for your contributions.
|
17
|
-
# Comment to post when closing a stale issue. Set to `false` to disable
|
18
|
-
closeComment: false
|