vagrant-vbguest 0.24.0 → 0.29.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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 24a98ba4b8c7a2b83a47eabdcf9f61336b88b4873bf3600164d31515ec1b5b2c
4
- data.tar.gz: e638b52785a1f5d7718840255a0c2df6f1b63d6e3af95a8edf1e1f6c1f1dce28
3
+ metadata.gz: 5b06593adf78b594ec9a8cd373156ce66b65c2c9636d5ce18b491031b1f42cea
4
+ data.tar.gz: 801da70b4ae593718792ea976f43f7cc3a5feaa16d342680a33d1cf9f3fe406d
5
5
  SHA512:
6
- metadata.gz: b7576c6a63d66c27ecdfcb1ea7a13d1ceb3decb8ac82a91063f8d22e93222f1a11d80876f26efe6c7807d2fc5024872810e0aaf033859714c3a264d465d78ce2
7
- data.tar.gz: b840b1d1bd9f069f3160089a47159722ff493b577760aa802e4618cb4859b3167ea72a8d91393bf55812cfdf8befdcab8f0b2741fe3f7d1a29df65ff65f62ec2
6
+ metadata.gz: ccebf9ed8b4ded67948a85d08fdf69021c46b9aff7dbd12d025a1516f4858f06b2102537efd484e715c5893e38d5fb4242cb123496abdd6ea7d2bb1b3ee8e81f
7
+ data.tar.gz: c872bcdb579253435983228ceb7cefe68aa7af4988a99d451b5ead39939e03061c2b6358b0b0919d23973ab4ef412e3aca868f8fd5e38ba320d0ca4c16e6f2e5
@@ -0,0 +1,13 @@
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"
@@ -1,3 +1,32 @@
1
+ ## 0.29.0 (2021-01-03)
2
+
3
+ - Add installer_option :enablerepo for CentOS. [GH-402], Fixes [GH-398]
4
+ - Add installer_option :running_kernel_modules for all Linux installers. [GH-403], Fixes [GH-396]
5
+
6
+ ## 0.28.0 (2020-11-20)
7
+
8
+ - 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]
9
+
10
+ ## 0.27.0 (2020-11-15)
11
+
12
+ - Un-mounting the guest additions iso will now take place in the cleanup step [GH-393]
13
+ - Running detection now checks for vboxguest and vboxsf kernel module. [GH-392], Fixes [GH-387]
14
+
15
+ ## 0.26.0 (2020-10-30)
16
+
17
+ - Add a new configuration `installer_hooks` allows to configure arbitrary scripts to be run on the guest before/after installer steps are executed.
18
+ - Fix RHEL8 perl vs. perl-interpreter [GH-368]
19
+ - On RedHat, use `dnf` instead of `yum` if available. [GH-368]
20
+ - Fix incorrect re-use of installer_* options.
21
+
22
+ ## 0.25.0 (2020-09-26)
23
+
24
+ - Renames mainline branch from "master" to "main"
25
+ - Fix not detecting running GuestAdditions on some systems [GH-347], [GH-376]. Thanks @Morac2 for [GH-377]
26
+ - Fixes package installation issues on CentOS 8.
27
+ CentOS installers no longe use the `--enablerepo` parameter when running `yum` to install packages.
28
+ Thanks @ghoneycutt for [GH-384]
29
+
1
30
  ## 0.24.0 (2020-04-29)
2
31
 
3
32
  No code changes to 0.24.0.beta1
@@ -80,7 +109,7 @@ See discussion in [GH-300]. Thanks @cbj4074 for asking the right questions.
80
109
 
81
110
  ## 0.15.2 (2018-05-22)
82
111
 
83
- - On RedHad based guest, the installer will now try to install the 'kernel-devel' package additionally to 'kernel-devel-`uname -r`' Thanks @ghoneycutt [GH-299]
112
+ - 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]
84
113
 
85
114
  ## 0.15.1 (2018-01-08)
86
115
 
@@ -0,0 +1,76 @@
1
+ # Contributor Covenant Code of Conduct
2
+
3
+ ## Our Pledge
4
+
5
+ In the interest of fostering an open and welcoming environment, we as
6
+ contributors and maintainers pledge to making participation in our project and
7
+ our community a harassment-free experience for everyone, regardless of age, body
8
+ size, disability, ethnicity, sex characteristics, gender identity and expression,
9
+ level of experience, education, socio-economic status, nationality, personal
10
+ appearance, race, religion, or sexual identity and orientation.
11
+
12
+ ## Our Standards
13
+
14
+ Examples of behavior that contributes to creating a positive environment
15
+ include:
16
+
17
+ * Using welcoming and inclusive language
18
+ * Being respectful of differing viewpoints and experiences
19
+ * Gracefully accepting constructive criticism
20
+ * Focusing on what is best for the community
21
+ * Showing empathy towards other community members
22
+
23
+ Examples of unacceptable behavior by participants include:
24
+
25
+ * The use of sexualized language or imagery and unwelcome sexual attention or
26
+ advances
27
+ * Trolling, insulting/derogatory comments, and personal or political attacks
28
+ * Public or private harassment
29
+ * Publishing others' private information, such as a physical or electronic
30
+ address, without explicit permission
31
+ * Other conduct which could reasonably be considered inappropriate in a
32
+ professional setting
33
+
34
+ ## Our Responsibilities
35
+
36
+ Project maintainers are responsible for clarifying the standards of acceptable
37
+ behavior and are expected to take appropriate and fair corrective action in
38
+ response to any instances of unacceptable behavior.
39
+
40
+ Project maintainers have the right and responsibility to remove, edit, or
41
+ reject comments, commits, code, wiki edits, issues, and other contributions
42
+ that are not aligned to this Code of Conduct, or to ban temporarily or
43
+ permanently any contributor for other behaviors that they deem inappropriate,
44
+ threatening, offensive, or harmful.
45
+
46
+ ## Scope
47
+
48
+ This Code of Conduct applies both within project spaces and in public spaces
49
+ when an individual is representing the project or its community. Examples of
50
+ representing a project or community include using an official project e-mail
51
+ address, posting via an official social media account, or acting as an appointed
52
+ representative at an online or offline event. Representation of a project may be
53
+ further defined and clarified by project maintainers.
54
+
55
+ ## Enforcement
56
+
57
+ Instances of abusive, harassing, or otherwise unacceptable behavior may be
58
+ reported by contacting the project team at info@dotless.de. All
59
+ complaints will be reviewed and investigated and will result in a response that
60
+ is deemed necessary and appropriate to the circumstances. The project team is
61
+ obligated to maintain confidentiality with regard to the reporter of an incident.
62
+ Further details of specific enforcement policies may be posted separately.
63
+
64
+ Project maintainers who do not follow or enforce the Code of Conduct in good
65
+ faith may face temporary or permanent repercussions as determined by other
66
+ members of the project's leadership.
67
+
68
+ ## Attribution
69
+
70
+ This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4,
71
+ available at https://www.contributor-covenant.org/version/1/4/code-of-conduct.html
72
+
73
+ [homepage]: https://www.contributor-covenant.org
74
+
75
+ For answers to common questions about this code of conduct, see
76
+ https://www.contributor-covenant.org/faq
data/Gemfile CHANGED
@@ -4,16 +4,16 @@ group :development do
4
4
  # We depend on Vagrant for development, but we don't add it as a
5
5
  # gem dependency because we expect to be installed within the
6
6
  # Vagrant environment itself using `vagrant plugin`.
7
- if ENV["VAGRANT_VERSION"]
8
- gem "vagrant", :git => "https://github.com/hashicorp/vagrant.git", tag: "v#{ENV["VAGRANT_VERSION"]}"
9
- elsif ENV["VAGRANT_LOCAL"]
10
- gem "vagrant", path: ENV["VAGRANT_LOCAL"]
7
+ if ENV['VAGRANT_VERSION']
8
+ gem 'vagrant', :git => 'https://github.com/hashicorp/vagrant.git', tag: "v#{ENV['VAGRANT_VERSION']}"
9
+ elsif ENV['VAGRANT_LOCAL']
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
- gem "rake", ">= 12.3.3"
14
+ gem 'rake', '>= 12.3.3'
15
15
  end
16
16
 
17
17
  group :plugins do
18
- gem "vagrant-vbguest", path: "."
18
+ gem 'vagrant-vbguest', path: '.'
19
19
  end
data/Readme.md CHANGED
@@ -4,7 +4,7 @@
4
4
 
5
5
  [![Join the chat at https://gitter.im/dotless-de/vagrant-vbguest](https://badges.gitter.im/Join%20Chat.svg)](https://gitter.im/dotless-de/vagrant-vbguest?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)
6
6
  [![Code Climate](https://codeclimate.com/github/dotless-de/vagrant-vbguest.svg)](https://codeclimate.com/github/dotless-de/vagrant-vbguest)
7
- [![Inline docs](http://inch-ci.org/github/dotless-de/vagrant-vbguest.svg?branch=master)](http://inch-ci.org/github/dotless-de/vagrant-vbguest)
7
+ [![Inline docs](http://inch-ci.org/github/dotless-de/vagrant-vbguest.svg?branch=main)](http://inch-ci.org/github/dotless-de/vagrant-vbguest)
8
8
  [![Gem Version](https://badge.fury.io/rb/vagrant-vbguest.svg)](https://badge.fury.io/rb/vagrant-vbguest)
9
9
 
10
10
 
@@ -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*.
@@ -302,14 +332,14 @@ end
302
332
 
303
333
  If you find yourself copying the same installer in each of your vagrant project, it might be a good idea to make it a plugin itself. Like vagrant-vbguest itself, installers can be [distributed as ruby gems](http://guides.rubygems.org/publishing/)
304
334
 
305
- This project contains a [sample installer gem](https://github.com/dotless-de/vagrant-vbguest/tree/master/testdrive/vagrant-vbguest-unikorn) which might serve as an boilerplate.
335
+ This project contains a [sample installer gem](https://github.com/dotless-de/vagrant-vbguest/tree/main/testdrive/vagrant-vbguest-unikorn) which might serve as an boilerplate.
306
336
 
307
337
 
308
338
  ## Contributing
309
339
 
310
340
  Bug reports and pull requests are welcome on GitHub at https://github.com/dotless-de/vagrant-vbguest.
311
341
 
312
- For the forseeable future, no more pull requests will be accepted which add new guest support/installers. Please build your gem as a plugin to vbguest (see "Very Advanced Usage" section of this file). In fact, please open a pull request to remove support for a guest system if feel confident that your solution is better.
342
+ For the foreseeable future, no more pull requests will be accepted which add new guest support/installers. Please build your gem as a plugin to vbguest (see "Very Advanced Usage" section of this file). In fact, please open a pull request to remove support for a guest system if feel confident that your solution is better.
313
343
 
314
344
 
315
345
  ## Known Issues
@@ -0,0 +1,10 @@
1
+ # Security Policy
2
+
3
+ ## Supported Versions
4
+
5
+ Only the latest version of vagrant-vbguest is supported and will receive security updates.
6
+
7
+ ## Reporting a Vulnerability
8
+
9
+ Download GPG key from: https://keybase.io/fnordfish/pgp_keys.asc (fingerprint `B3CA4DF4D703CBDFFF211CB8A8B249A38963D0B6`)
10
+ Write an gpg encrypted email to `vbguest-security@dotless.de`
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.24.0
1
+ 0.29.0
@@ -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
- # hook after anything that boots:
56
- # that's all middlewares which will run the buildin "VM::Boot" action
57
- action_hook('vbguest') do |hook|
58
- if defined?(VagrantPlugins::ProviderVirtualBox::Action::CheckGuestAdditions)
59
- hook.before(VagrantPlugins::ProviderVirtualBox::Action::CheckGuestAdditions, VagrantVbguest::Middleware)
60
- else
61
- hook.after(VagrantPlugins::ProviderVirtualBox::Action::Boot, VagrantVbguest::Middleware)
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
@@ -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
- installer.install do |type, data|
64
- @env.ui.info(data, :prefix => false, :new_line => false)
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
- installer.rebuild do |type, data|
75
- @env.ui.info(data, :prefix => false, :new_line => false)
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
- installer.start do |type, data|
84
- @env.ui.info(data, :prefix => false, :new_line => false)
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
- @guest_installer.cleanup if @guest_installer
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
@@ -236,12 +236,13 @@ module VagrantVbguest
236
236
 
237
237
  # A helper method to delete the uploaded GuestAdditions iso file
238
238
  # from the guest box
239
- def cleanup
239
+ def cleanup(opts, &block)
240
240
  unless options[:no_cleanup]
241
241
  @host.cleanup
242
- communicate.execute("test -f #{tmp_path} && rm #{tmp_path}", :error_check => false) do |type, data|
243
- env.ui.error(data.chomp, :prefix => false)
244
- end
242
+
243
+ opts = (opts || {}).merge(:error_check => false)
244
+ block ||= proc { |type, data| env.ui.error(data.chomp, :prefix => false) }
245
+ communicate.execute("test -f #{tmp_path} && rm #{tmp_path}", opts, &block)
245
246
  end
246
247
  end
247
248
  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)
@@ -68,8 +88,7 @@ module VagrantVbguest
68
88
  end
69
89
 
70
90
  def install_kernel_devel(opts=nil, &block)
71
- rel = has_rel_repo? ? release_version : '*'
72
- cmd = "yum install -y kernel-devel-`uname -r` --enablerepo=C#{rel}-base --enablerepo=C#{rel}-updates"
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
- opts = {
79
- :sudo => true
80
- }.merge(opts || {})
81
- communicate.test('grep -qE "^vboxguest\s.+\s\([^\s]*O[^\s]*\)$" /proc/modules && ls /lib/modules/`uname -r`/misc/vboxsf.ko*', opts, &block)
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
- "yum install -y #{dependencies}"
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
- 'perl',
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",
@@ -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.
@@ -23,4 +23,10 @@ Gem::Specification.new do |s|
23
23
  s.executables = s.files.grep(%r{^exe/}) { |f| File.basename(f) }
24
24
  s.require_paths = ["lib"]
25
25
 
26
+ s.metadata = {
27
+ "bug_tracker_uri" => "https://github.com/dotless-de/vagrant-vbguest/issues",
28
+ "changelog_uri" => "https://github.com/dotless-de/vagrant-vbguest/blob/main/CHANGELOG.md",
29
+ "documentation_uri" => "http://rubydoc.info/gems/vagrant-vbguest",
30
+ "source_code_uri" => "https://github.com/dotless-de/vagrant-vbguest"
31
+ }
26
32
  end
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.24.0
4
+ version: 0.29.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Robert Schulze
8
- autorequire:
8
+ autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2020-04-29 00:00:00.000000000 Z
11
+ date: 2021-01-03 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: micromachine
@@ -66,13 +66,16 @@ executables: []
66
66
  extensions: []
67
67
  extra_rdoc_files: []
68
68
  files:
69
+ - ".github/dependabot.yml"
69
70
  - ".github/stale.yml"
70
71
  - ".gitignore"
71
72
  - CHANGELOG.md
73
+ - CODE_OF_CONDUCT.md
72
74
  - Gemfile
73
75
  - LICENSE
74
76
  - Rakefile
75
77
  - Readme.md
78
+ - SECURITY.md
76
79
  - VERSION
77
80
  - lib/vagrant-vbguest.rb
78
81
  - lib/vagrant-vbguest/command.rb
@@ -107,8 +110,12 @@ files:
107
110
  homepage: https://github.com/dotless-de/vagrant-vbguest
108
111
  licenses:
109
112
  - MIT
110
- metadata: {}
111
- post_install_message:
113
+ metadata:
114
+ bug_tracker_uri: https://github.com/dotless-de/vagrant-vbguest/issues
115
+ changelog_uri: https://github.com/dotless-de/vagrant-vbguest/blob/main/CHANGELOG.md
116
+ documentation_uri: http://rubydoc.info/gems/vagrant-vbguest
117
+ source_code_uri: https://github.com/dotless-de/vagrant-vbguest
118
+ post_install_message:
112
119
  rdoc_options: []
113
120
  require_paths:
114
121
  - lib
@@ -124,7 +131,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
124
131
  version: 1.3.6
125
132
  requirements: []
126
133
  rubygems_version: 3.0.3
127
- signing_key:
134
+ signing_key:
128
135
  specification_version: 4
129
136
  summary: A Vagrant plugin to install the VirtualBoxAdditions into the guest VM
130
137
  test_files: []