vagrant-vbguest 0.31.0 → 0.32.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 3648ade616bfaddafaf75b6a48be6e8744e34b78ee97aa312c351a199fe1341c
4
- data.tar.gz: 303b9330920b71330cbf16faf9b8230e0a50046017bfc1c14099c75bf50a8546
3
+ metadata.gz: cee12b08e10b796656c3f2ed706fa3a7757f85b597d2a9d09bc6ab802c0a6242
4
+ data.tar.gz: 1cdedccd2a2f38e19a945102b8cce02299f47c6ef459f59abc8c362041742198
5
5
  SHA512:
6
- metadata.gz: ae76c53cfee6318338cb2ee6c51759855d9891a6b645baff5262e7632a747c1a92c29f6b87b3e96a8cfa1f38484e8cc8451d28060cdc06803487c1d4eb210597
7
- data.tar.gz: 98a67568739b232630c73ec73cdbea72201687cb16e5cc746bf63755d2ba95b2ccc1b894c3b32926d0374ff8bd355849d3aadfd41adace9ea04821efb39ae29d
6
+ metadata.gz: 1323fbd94936e520062e0a6e6ca6759ac0e22367d5c9e3760a0af749e23e0db038a3d2777421a182b3d9baba81b8fbef94905861bd1e121aed43e39782a4d366
7
+ data.tar.gz: 4a7256387e9c82e4f29f12ad3286c07eb735dc36a2c969f8fde419a8ecc5aaa633c15d7e6fb5f787ebf5ad184968f639d9395ef780cbbdfebd0922def9f377a3
data/CHANGELOG.md CHANGED
@@ -1,3 +1,12 @@
1
+ # Changelog
2
+
3
+ ## 0.32.0 (2023-12-17)
4
+
5
+ - Fix testing for running GuestAdditions on Linux, when reading `/proc/modules` returns in
6
+ multiple chunks. Thanks @kubasov-s [GH-436]
7
+ - Use RedHat installer for AlmaLinux. Thanks @alexgit2k [GH-431]
8
+ - Don't unmount the GuestAdditions iso when it's not mounted. Ignore errors during un-mounting. [GH-434]
9
+
1
10
  ## 0.31.0 (2022-11-28)
2
11
 
3
12
  - Use the CentOS installer when detecting Rocky Linux. Thanks @djflux [GH-424]
data/Readme.md CHANGED
@@ -1,5 +1,10 @@
1
1
  # vagrant-vbguest
2
2
 
3
+ **Please note that as of 2023-12-17, this project is archived and will not receive further updates or support from me.**
4
+ **However, the existing codebase will remain available for reference and use under the project's open-source license.**
5
+
6
+ ---
7
+
3
8
  *vagrant-vbguest* is a [Vagrant](http://vagrantup.com) plugin which automatically installs the host's VirtualBox Guest Additions on the guest system.
4
9
 
5
10
  [![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)
@@ -7,7 +12,6 @@
7
12
  [![Inline docs](http://inch-ci.org/github/dotless-de/vagrant-vbguest.svg?branch=main)](http://inch-ci.org/github/dotless-de/vagrant-vbguest)
8
13
  [![Gem Version](https://badge.fury.io/rb/vagrant-vbguest.svg)](https://badge.fury.io/rb/vagrant-vbguest)
9
14
 
10
-
11
15
  ## Installation
12
16
 
13
17
  Requires vagrant 1.3 or later
@@ -15,12 +19,12 @@ Requires vagrant 1.3 or later
15
19
  ### Vagrant ≥ 1.3
16
20
 
17
21
  ```bash
18
- $ vagrant plugin install vagrant-vbguest
22
+ vagrant plugin install vagrant-vbguest
19
23
  ```
20
24
 
21
25
  ## Configuration / Usage
22
26
 
23
- If you're lucky, *vagrant-vbguest* does not require any configuration.
27
+ If you're lucky, *vagrant-vbguest* does not require any configuration.
24
28
  However, here is an example of `Vagrantfile`:
25
29
 
26
30
  ```ruby
@@ -51,18 +55,28 @@ The default URI for the actual iso download is: `https://download.virtualbox.org
51
55
  vbguest will try to autodetect the best option for your system. WTF? see below.
52
56
  * `iso_upload_path` (String, default: `/tmp`): A writeable directory where to put the VBoxGuestAdditions.iso file on the guest system.
53
57
  * `iso_mount_point` (String, default: `/mnt`): Where to mount the VBoxGuestAdditions.iso file on the guest system.
54
- * `auto_update` (Boolean, default: `true`) : Whether to check the correct additions version on each start (where start is _not_ resuming a box).
58
+ * `auto_update` (Boolean, default: `true`) : Whether to check the correct additions version on each start (where start is *not* resuming a box).
55
59
  * `auto_reboot` (Boolean, default: `true` when running as a middleware, `false` when running as a command) : Whether to reboot the box after GuestAdditions has been installed, but not loaded.
56
- * `allow_downgrade` (Boolean, default: `true`) : Allow to install an older version of Guest Additions onto the guest. (Eg. your are running a host with VirtualBox 5 and the box is already on 6).
60
+ * `allow_downgrade` (Boolean, default: `true`) : Allow to install an older version of Guest Additions onto the guest. (Eg. you are running a host with VirtualBox 5 and the box is already on 6).
57
61
  * `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.
58
- * `no_remote` (Boolean, default: `false`) : Whether to _not_ download the iso file from a remote location. This includes any `http` location!
59
- * `installer` (`VagrantVbguest::Installers::Base`, optional) : Reference to a (custom) installer class
62
+ * `no_remote` (Boolean, default: `false`) : Whether to *not* download the iso file from a remote location. This includes any `http` location!
63
+ * `installer` (`VagrantVbguest::Installers::Base`, optional) : Reference to a (custom) installer class or a named installer.
64
+ Build-in named installers are:
65
+ * `:arch`, `:archlinux`, `:arch_linux` : Arch Linux
66
+ * `:centos`, `:cent_os` : CentOS
67
+ * `:debian` : Debian
68
+ * `:fedora` : Fedora
69
+ * `:opensuse`, `:open_suse` : openSUSE
70
+ * `:oracle`, `:oraclelinux`, `:oracle_linux` : Oracle Linux
71
+ * `:redhat`, `:red_hat` : Red Hat
72
+ * `:suse` : SUSE
73
+ * `:ubuntu` : Ubuntu
74
+ * `:windows` : Windows
60
75
  * `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
76
  * `installer_options` (Hash, default: `{}`) : Configure how a Installer internally works. Should be set on a `vm` level.
62
77
  * `installer_hooks` (Hash, default: `{}`) : Configure scripts to be run before/after installer steps.
63
78
  * `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)
64
79
 
65
-
66
80
  #### Installer Specific Options (`installer_options`)
67
81
 
68
82
  Those settings are specific for OS-specific installer. Especially in a multi-box environment, you should put those options on the box configuration like this:
@@ -98,6 +112,7 @@ Vagrant.configure("2") do |config|
98
112
  end
99
113
  end
100
114
  ```
115
+
101
116
  ##### Linux
102
117
 
103
118
  This option is available on all Linux type installers.
@@ -109,10 +124,10 @@ This option is available on all Linux type installers.
109
124
  * `: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.
110
125
  * `:reboot_timeout` (default: `300`): Maximum number of seconds to wait for the box to reboot after a kernel upgrade.
111
126
  * `: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`
127
+ * Single String: `"C*-base"` converts to `--enablerepo=C*-base`
128
+ * Array of Strings: `['C*-base', 'C*-updates']` converts to `--enablerepo=C*-base --enablerepo=C*-updates`
129
+ * `true`: Enables `C${release_version}-base` and `C${release_version}-updates` with release_version read from `/etc/centos-release` if the repo exists, otherwise `*`.
130
+ * `false`: Does not set any `--enablerepo`
116
131
 
117
132
  #### Global Configuration
118
133
 
@@ -137,7 +152,6 @@ VagrantVbguest::Config.auto_update = false
137
152
 
138
153
  Settings in a project's `Vagrantfile` will overwrite those setting. When executed as a command, command line arguments will overwrite all of the above.
139
154
 
140
-
141
155
  #### Installer Hooks (`installer_hooks`)
142
156
 
143
157
  Additionally to the build-in `installer_options`, you can configure to execute scripts around the install steps `install`, `rebuild` and `start`.
@@ -157,11 +171,10 @@ Vagrant.configure("2") do |config|
157
171
  end
158
172
  ```
159
173
 
160
-
161
174
  ### Running as a middleware
162
175
 
163
- Running as a middleware is the default way of using *vagrant-vbguest*.
164
- It will run automatically right after the box started. This is each time the box boots, i.e. `vagrant up` or `vagrant reload`.
176
+ Running as a middleware is the default way of using *vagrant-vbguest*.
177
+ It will run automatically right after the box started. This is each time the box boots, i.e. `vagrant up` or `vagrant reload`.
165
178
  It won't run on `vagrant resume` (or `vagrant up` a suspended box) to save you some time resuming a box.
166
179
 
167
180
  You may switch off the middleware by setting the vm's config `vbguest.auto_update` to `false`.
@@ -169,59 +182,60 @@ This is a per box setting. On multi vm environments you need to set that for eac
169
182
 
170
183
  When *vagrant-vbguest* is running it will provide you some logs:
171
184
 
172
- [...]
173
- [default] Booting VM...
174
- [default] Booting VM...
175
- [default] Waiting for VM to boot. This can take a few minutes.
176
- [default] VM booted and ready for use!
177
- [default] GuestAdditions versions on your host (4.2.6) and guest (4.1.0) do not match.
178
- stdin: is not a tty
179
- Reading package lists...
180
- Building dependency tree...
181
- Reading state information...
182
- The following extra packages will be installed:
183
- fakeroot linux-headers-2.6.32-33 patch
184
-
185
- [...]
186
-
187
- [default] Copy iso file /Applications/VirtualBox.app/Contents/MacOS/VBoxGuestAdditions.iso into the box /tmp/VBoxGuestAdditions.iso
188
- stdin: is not a tty
189
- [default] Installing Virtualbox Guest Additions 4.2.6 - guest version is 4.1.0
190
- stdin: is not a tty
191
- Verifying archive integrity... All good.
192
- Uncompressing VirtualBox 4.2.6 Guest Additions for Linux...........
193
- VirtualBox Guest Additions installer
194
- Removing installed version 4.1.0 of VirtualBox Guest Additions...
195
- tar: Record size = 8 blocks
196
- Removing existing VirtualBox DKMS kernel modules ...done.
197
- Removing existing VirtualBox non-DKMS kernel modules ...done.
198
- Building the VirtualBox Guest Additions kernel modules ...done.
199
- Doing non-kernel setup of the Guest Additions ...done.
200
- You should restart your guest to make sure the new modules are actually used
201
-
202
- Installing the Window System drivers ...fail!
203
- (Could not find the X.Org or XFree86 Window System.)
204
- stdin: is not a tty
205
- [default] Restarting VM to apply changes...
206
- [default] Attempting graceful shutdown of VM...
207
- [default] Booting VM...
208
- [default] Waiting for VM to boot. This can take a few minutes.
209
- [default] VM booted and ready for use!
210
- [default] Configuring and enabling network interfaces...
211
- [default] Setting host name...
212
- [default] Mounting shared folders...
213
- [default] -- v-root: /vagrant
214
- [default] -- v-csc-1: /tmp/vagrant-chef-1/chef-solo-1/cookbooks
215
- [default] Running provisioner: Vagrant::Provisioners::ChefSolo...
216
- [default] Generating chef JSON and uploading...
217
- [default] Running chef-solo...
218
- [...]
219
-
185
+ ```log
186
+ [...]
187
+ [default] Booting VM...
188
+ [default] Booting VM...
189
+ [default] Waiting for VM to boot. This can take a few minutes.
190
+ [default] VM booted and ready for use!
191
+ [default] GuestAdditions versions on your host (4.2.6) and guest (4.1.0) do not match.
192
+ stdin: is not a tty
193
+ Reading package lists...
194
+ Building dependency tree...
195
+ Reading state information...
196
+ The following extra packages will be installed:
197
+ fakeroot linux-headers-2.6.32-33 patch
198
+
199
+ [...]
200
+
201
+ [default] Copy iso file /Applications/VirtualBox.app/Contents/MacOS/VBoxGuestAdditions.iso into the box /tmp/VBoxGuestAdditions.iso
202
+ stdin: is not a tty
203
+ [default] Installing Virtualbox Guest Additions 4.2.6 - guest version is 4.1.0
204
+ stdin: is not a tty
205
+ Verifying archive integrity... All good.
206
+ Uncompressing VirtualBox 4.2.6 Guest Additions for Linux...........
207
+ VirtualBox Guest Additions installer
208
+ Removing installed version 4.1.0 of VirtualBox Guest Additions...
209
+ tar: Record size = 8 blocks
210
+ Removing existing VirtualBox DKMS kernel modules ...done.
211
+ Removing existing VirtualBox non-DKMS kernel modules ...done.
212
+ Building the VirtualBox Guest Additions kernel modules ...done.
213
+ Doing non-kernel setup of the Guest Additions ...done.
214
+ You should restart your guest to make sure the new modules are actually used
215
+
216
+ Installing the Window System drivers ...fail!
217
+ (Could not find the X.Org or XFree86 Window System.)
218
+ stdin: is not a tty
219
+ [default] Restarting VM to apply changes...
220
+ [default] Attempting graceful shutdown of VM...
221
+ [default] Booting VM...
222
+ [default] Waiting for VM to boot. This can take a few minutes.
223
+ [default] VM booted and ready for use!
224
+ [default] Configuring and enabling network interfaces...
225
+ [default] Setting host name...
226
+ [default] Mounting shared folders...
227
+ [default] -- v-root: /vagrant
228
+ [default] -- v-csc-1: /tmp/vagrant-chef-1/chef-solo-1/cookbooks
229
+ [default] Running provisioner: Vagrant::Provisioners::ChefSolo...
230
+ [default] Generating chef JSON and uploading...
231
+ [default] Running chef-solo...
232
+ [...]
233
+ ```
220
234
 
221
235
  The plugin's part starts at `[default] Installing Virtualbox Guest Additions 4.1.14 - guest's version is 4.1.1`, telling you that:
222
236
 
223
- * the guest addition of the box *default* is outdated (or mismatching)
224
- * which guest additions iso file will be used
237
+ * the guest addition of the box *default* is outdated (or mismatching)
238
+ * which guest additions iso file will be used
225
239
  * which installer script will be used
226
240
  * all the VirtualBox Guest Additions installer output.
227
241
 
@@ -229,20 +243,21 @@ No worries on the `Installing the Window System drivers ...fail!`. Most dev boxe
229
243
 
230
244
  When everything is fine, and no update is needed, you see log like:
231
245
 
232
- ...
233
- [default] Booting VM...
234
- [default] Waiting for VM to boot. This can take a few minutes.
235
- [default] VM booted and ready for use!
236
- [default] GuestAdditions 4.2.6 running --- OK.
237
- ...
238
-
246
+ ```log
247
+ [...]
248
+ [default] Booting VM...
249
+ [default] Waiting for VM to boot. This can take a few minutes.
250
+ [default] VM booted and ready for use!
251
+ [default] GuestAdditions 4.2.6 running --- OK.
252
+ [...]
253
+ ```
239
254
 
240
255
  ### Running as a Command
241
256
 
242
257
  When you switched off the middleware auto update, or you have a box up and running you may also run the installer manually.
243
258
 
244
259
  ```bash
245
- $ vagrant vbguest [vm-name] [--do start|rebuild|install] [--status] [-f|--force] [-b|--auto-reboot] [-R|--no-remote] [--iso VBoxGuestAdditions.iso] [--no-cleanup]
260
+ vagrant vbguest [vm-name] [--do start|rebuild|install] [--status] [-f|--force] [-b|--auto-reboot] [-R|--no-remote] [--iso VBoxGuestAdditions.iso] [--no-cleanup]
246
261
  ```
247
262
 
248
263
  For example, when you just updated VirtualBox on your host system, you should update the guest additions right away. However, you may need to reload the box to get the guest additions working.
@@ -250,43 +265,46 @@ For example, when you just updated VirtualBox on your host system, you should up
250
265
  If you want to check the guest additions version, without installing, you may run:
251
266
 
252
267
  ```bash
253
- $ vagrant vbguest --status
268
+ vagrant vbguest --status
254
269
  ```
255
270
 
256
271
  Telling you either about a version mismatch:
257
272
 
258
- [default] GuestAdditions versions on your host (4.2.6) and guest (4.1.0) do not match.
273
+ ```log
274
+ [default] GuestAdditions versions on your host (4.2.6) and guest (4.1.0) do not match.
275
+ ```
259
276
 
260
277
  or a match:
261
278
 
262
- [default] GuestAdditions 4.2.6 running --- OK.
263
-
279
+ ```log
280
+ [default] GuestAdditions 4.2.6 running --- OK.
281
+ ```
264
282
 
265
283
  The `auto-reboot` is turned off by default when running as a command. Vbguest will suggest you to reboot the box when needed. To turn it on simply pass the `--auto-reboot` parameter:
266
284
 
267
285
  ```bash
268
- $ vagrant vbguest --auto-reboot
286
+ vagrant vbguest --auto-reboot
269
287
  ```
270
288
 
271
289
  You can also pass vagrant's `reload` options like:
272
290
 
273
291
  ```bash
274
- $ vagrant vbguest --auto-reboot --no-provision
292
+ vagrant vbguest --auto-reboot --no-provision
275
293
  ```
276
294
 
277
295
  When running the install step manually like this: `vagrant vbguest --do install`, adding `--no-cleanup` keeps the downloaded, uploaded files and mounted iso in their place. Happy debugging ;)
278
296
 
279
297
  ### ISO autodetection
280
298
 
281
- *vagrant-vbguest* will try to autodetect a VirtualBox GuestAdditions iso file on your system, which usually matches your installed version of VirtualBox. If it cannot find one, it downloads one from the web (virtualbox.org).
299
+ *vagrant-vbguest* will try to autodetect a VirtualBox GuestAdditions iso file on your system, which usually matches your installed version of VirtualBox. If it cannot find one, it downloads one from the web (virtualbox.org).
282
300
  Those places will be checked in order:
283
301
 
284
302
  1. Checks your VirtualBox "Virtual Media Manager" for a DVD called "VBoxGuestAdditions.iso"
285
303
  2. Guess by your host operating system:
286
- * for linux : `/usr/share/virtualbox/VBoxGuestAdditions.iso`
287
- * for Mac : `/Applications/VirtualBox.app/Contents/MacOS/VBoxGuestAdditions.iso`
288
- * for Windows : `%PROGRAMFILES%/Oracle/VirtualBox/VBoxGuestAdditions.iso`
289
304
 
305
+ * for linux : `/usr/share/virtualbox/VBoxGuestAdditions.iso`
306
+ * for Mac : `/Applications/VirtualBox.app/Contents/MacOS/VBoxGuestAdditions.iso`
307
+ * for Windows : `%PROGRAMFILES%/Oracle/VirtualBox/VBoxGuestAdditions.iso`
290
308
 
291
309
  ### Automatic reboot
292
310
 
@@ -294,7 +312,6 @@ The VirtualBox GuestAdditions Installer will try to load the newly built kernel
294
312
 
295
313
  Hence, vbguest will check for a loaded kernel module after the installation has finished and reboots the box, if it could not find one.
296
314
 
297
-
298
315
  ## Advanced Usage
299
316
 
300
317
  vagrant-vbguest provides installers for generic linux and debian/ubuntu.
@@ -327,21 +344,18 @@ Vagrant::Config.run do |config|
327
344
  end
328
345
  ```
329
346
 
330
-
331
347
  ### Extending vbguest (aka Very Advanced Usage)
332
348
 
333
349
  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/)
334
350
 
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.
336
-
351
+ 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.
337
352
 
338
353
  ## Contributing
339
354
 
340
- Bug reports and pull requests are welcome on GitHub at https://github.com/dotless-de/vagrant-vbguest.
355
+ Bug reports and pull requests are welcome on GitHub at <https://github.com/dotless-de/vagrant-vbguest>.
341
356
 
342
357
  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.
343
358
 
344
-
345
359
  ## Known Issues
346
360
 
347
361
  * The installer script, which mounts and runs the GuestAdditions Installer Binary, works on Linux only. Most likely it will run on most Unix-like platforms.
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.31.0
1
+ 0.32.0
@@ -26,12 +26,30 @@ module VagrantVbguest
26
26
  # specific version of a distribution should use heigher
27
27
  # priority numbers.
28
28
  #
29
+ # @param installer_key [Symbol] A key to identify the Installer class.
29
30
  # @param installer_class [Class] A reference to the Installer class.
30
31
  # @param prio [Fixnum] Priority describing how specific the Installer matches. (default: `5`)
31
- def register(installer_class, prio = 5)
32
+ def register(*args)
33
+ installer_key = nil
34
+ installer_class = nil
35
+ prio = 5
36
+
37
+ if args.first.is_a?(Symbol) || args.first.is_a?(String)
38
+ installer_key = args.first.to_s
39
+ installer_class = args[1]
40
+ prio = args[2] if args[2]
41
+ else
42
+ warn "DEPRECATION: Passing Installer class directly to Installer.register is deprecated. Please use a registration identifier as first argument. `Installer.register(:my_system, MySystemInstaller, 1)`"
43
+ installer_class = args.first
44
+ prio = args[1] if args[1]
45
+ end
46
+
32
47
  @installers ||= {}
33
- @installers[prio] ||= []
48
+ @installers[prio] ||= Set.new
34
49
  @installers[prio] << installer_class
50
+
51
+ @registered ||= {}
52
+ @registered[installer_key] = installer_class if installer_key
35
53
  end
36
54
 
37
55
  ##
@@ -47,6 +65,15 @@ module VagrantVbguest
47
65
  end
48
66
  return nil
49
67
  end
68
+
69
+ ##
70
+ # Returns the registered Installer class for the given key.
71
+ #
72
+ # @param key [Symbol, String]
73
+ # @return [Class,nil]
74
+ def get(key)
75
+ @registered[key.to_s]
76
+ end
50
77
  end
51
78
 
52
79
  def initialize(vm, options = {})
@@ -143,8 +170,11 @@ module VagrantVbguest
143
170
  end
144
171
 
145
172
  def guest_installer_class
146
- if @options[:installer].is_a?(Class)
147
- @options[:installer]
173
+ case (installer = @options[:installer])
174
+ when Class
175
+ installer
176
+ when Symbol, String
177
+ Installer.get(installer)
148
178
  else
149
179
  Installer.detect(@vm, @options)
150
180
  end
@@ -26,4 +26,6 @@ module VagrantVbguest
26
26
  end
27
27
  end
28
28
  end
29
- VagrantVbguest::Installer.register(VagrantVbguest::Installers::Archlinux, 5)
29
+ VagrantVbguest::Installer.register(:arch, VagrantVbguest::Installers::Archlinux, 5)
30
+ VagrantVbguest::Installer.register(:archlinux, VagrantVbguest::Installers::Archlinux, 5)
31
+ VagrantVbguest::Installer.register(:arch_linux, VagrantVbguest::Installers::Archlinux, 5)
@@ -119,4 +119,5 @@ module VagrantVbguest
119
119
  end
120
120
  end
121
121
  # Load this before the RedHat one, as we want it to be picked up first. (The higher the sooner its checked).
122
- VagrantVbguest::Installer.register(VagrantVbguest::Installers::CentOS, 6)
122
+ VagrantVbguest::Installer.register(:centos, VagrantVbguest::Installers::CentOS, 6)
123
+ VagrantVbguest::Installer.register(:cent_os, VagrantVbguest::Installers::CentOS, 6)
@@ -44,4 +44,4 @@ module VagrantVbguest
44
44
  end
45
45
  end
46
46
  end
47
- VagrantVbguest::Installer.register(VagrantVbguest::Installers::Debian, 5)
47
+ VagrantVbguest::Installer.register(:debian, VagrantVbguest::Installers::Debian, 5)
@@ -24,4 +24,4 @@ module VagrantVbguest
24
24
  end
25
25
  end
26
26
  end
27
- VagrantVbguest::Installer.register(VagrantVbguest::Installers::Fedora, 5)
27
+ VagrantVbguest::Installer.register(:fedora, VagrantVbguest::Installers::Fedora, 5)
@@ -74,19 +74,20 @@ module VagrantVbguest
74
74
  # @yieldparam [String] type Type of the output, `:stdout`, `:stderr`, etc.
75
75
  # @yieldparam [String] data Data for the given output.
76
76
  def running?(opts=nil, &block)
77
- kmods = nil
77
+ kmods = []
78
78
  communicate.sudo('cat /proc/modules', opts) do |type, data|
79
79
  block.call(type, data) if block
80
- kmods = data if type == :stdout && data
80
+ kmods << data if type == :stdout && data
81
81
  end
82
82
 
83
- unless kmods
83
+ if kmods.empty?
84
84
  env.ui.warn "Could not read /proc/modules"
85
85
  return true
86
86
  end
87
87
 
88
88
  Array(installer_options[:running_kernel_modules]).all? do |mod|
89
- /^#{mod}\b/i.match(kmods)
89
+ regexp = /^#{mod}\b/i
90
+ kmods.any? { |d| regexp.match(d) }
90
91
  end
91
92
  end
92
93
 
@@ -270,6 +271,7 @@ module VagrantVbguest
270
271
  def mount_iso(opts=nil, &block)
271
272
  env.ui.info(I18n.t("vagrant_vbguest.mounting_iso", :mount_point => mount_point))
272
273
  communicate.sudo("mount #{tmp_path} -o loop #{mount_point}", opts, &block)
274
+ @mounted = true
273
275
  end
274
276
 
275
277
  # A generic helper method for un-mounting the GuestAdditions iso file
@@ -281,8 +283,15 @@ module VagrantVbguest
281
283
  # @yieldparam [String] type Type of the output, `:stdout`, `:stderr`, etc.
282
284
  # @yieldparam [String] data Data for the given output.
283
285
  def unmount_iso(opts=nil, &block)
286
+ unless @mounted
287
+ env.ui.info(I18n.t("vagrant_vbguest.skip_unmounting_iso"))
288
+ return
289
+ end
290
+
284
291
  env.ui.info(I18n.t("vagrant_vbguest.unmounting_iso", :mount_point => mount_point))
292
+ opts = (opts || {}).merge(:error_check => false)
285
293
  communicate.sudo("umount #{mount_point}", opts, &block)
294
+ @mounted = false
286
295
  end
287
296
 
288
297
  def cleanup(opts=nil, &block)
@@ -294,4 +303,4 @@ module VagrantVbguest
294
303
  end
295
304
  end
296
305
  end
297
- VagrantVbguest::Installer.register(VagrantVbguest::Installers::Linux, 2)
306
+ VagrantVbguest::Installer.register(:linux, VagrantVbguest::Installers::Linux, 2)
@@ -33,4 +33,5 @@ module VagrantVbguest
33
33
  end
34
34
  end
35
35
  end
36
- VagrantVbguest::Installer.register(VagrantVbguest::Installers::OpenSuse, 5)
36
+ VagrantVbguest::Installer.register(:opensuse, VagrantVbguest::Installers::OpenSuse, 5)
37
+ VagrantVbguest::Installer.register(:open_suse, VagrantVbguest::Installers::OpenSuse, 5)
@@ -22,4 +22,6 @@ module VagrantVbguest
22
22
  end
23
23
  end
24
24
  end
25
- VagrantVbguest::Installer.register(VagrantVbguest::Installers::Oracle, 6)
25
+ VagrantVbguest::Installer.register(:oracle, VagrantVbguest::Installers::Oracle, 6)
26
+ VagrantVbguest::Installer.register(:oraclelinux, VagrantVbguest::Installers::Oracle, 6)
27
+ VagrantVbguest::Installer.register(:oracle_linux, VagrantVbguest::Installers::Oracle, 6)
@@ -5,7 +5,7 @@ module VagrantVbguest
5
5
  # fortunately they're probably both similar enough to RHEL
6
6
  # (RedHat Enterprise Linux) not to matter.
7
7
  def self.match?(vm)
8
- /\A(redhat|centos|amazon|rocky)\d*\Z/ =~ self.distro(vm)
8
+ /\A(redhat|centos|amazon|rocky|alma)\d*\Z/ =~ self.distro(vm)
9
9
  end
10
10
 
11
11
  # Install missing deps and yield up to regular linux installation
@@ -49,4 +49,5 @@ module VagrantVbguest
49
49
  end
50
50
  end
51
51
  end
52
- VagrantVbguest::Installer.register(VagrantVbguest::Installers::RedHat, 5)
52
+ VagrantVbguest::Installer.register(:redhat, VagrantVbguest::Installers::RedHat, 5)
53
+ VagrantVbguest::Installer.register(:red_hat, VagrantVbguest::Installers::RedHat, 5)
@@ -42,4 +42,4 @@ module VagrantVbguest
42
42
  end
43
43
  end
44
44
  end
45
- VagrantVbguest::Installer.register(VagrantVbguest::Installers::Suse, 6)
45
+ VagrantVbguest::Installer.register(:suse, VagrantVbguest::Installers::Suse, 6)
@@ -46,4 +46,4 @@ module VagrantVbguest
46
46
  end
47
47
  end
48
48
  end
49
- VagrantVbguest::Installer.register(VagrantVbguest::Installers::Ubuntu, 5)
49
+ VagrantVbguest::Installer.register(:ubuntu, VagrantVbguest::Installers::Ubuntu, 5)
@@ -104,12 +104,16 @@ module VagrantVbguest
104
104
  def mount_iso(opts = nil, &block)
105
105
  communicate.execute("Mount-DiskImage -ImagePath #{tmp_path}", opts, &block)
106
106
  env.ui.info(I18n.t("vagrant_vbguest.mounting_iso", mount_point: mount_point))
107
+ @mounted = true
107
108
  end
108
109
 
109
110
  def unmount_iso(opts = nil, &block)
111
+ return unless @mounted
110
112
  env.ui.info(I18n.t("vagrant_vbguest.unmounting_iso",mount_point: mount_point))
113
+ opts = (opts || {}).merge(:error_check => false)
111
114
  communicate.execute("Dismount-DiskImage -ImagePath #{tmp_path}", opts, &block)
112
115
  communicate.execute("Remove-Item -Path #{tmp_path}", opts, &block)
116
+ @mounted = false
113
117
  end
114
118
 
115
119
  def cleanup(opts = nil, &block)
@@ -128,4 +132,4 @@ module VagrantVbguest
128
132
  end
129
133
  end
130
134
  end
131
- VagrantVbguest::Installer.register(VagrantVbguest::Installers::Windows, 2)
135
+ VagrantVbguest::Installer.register(:windows, VagrantVbguest::Installers::Windows, 2)
data/locales/en.yml CHANGED
@@ -4,6 +4,7 @@ en:
4
4
  skipped_rebuild: "Rebuilding GuestAdditions skipped."
5
5
  mounting_iso: "Mounting Virtualbox Guest Additions ISO to: %{mount_point}"
6
6
  unmounting_iso: "Unmounting Virtualbox Guest Additions ISO from: %{mount_point}"
7
+ skip_unmounting_iso: "Skipping unmount of Virtualbox Guest Additions ISO, because it was not mounted."
7
8
  installing: "Installing Virtualbox Guest Additions %{installer_version} - guest version is %{guest_version}"
8
9
  installing_forced: "Forcing installation of Virtualbox Guest Additions %{installer_version} - guest version is %{guest_version}"
9
10
  rebuild: "Rebuilding Virtualbox Guest Additions %{guest_version} (Your host version is %{host_version})"
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.31.0
4
+ version: 0.32.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: 2022-11-28 00:00:00.000000000 Z
11
+ date: 2023-12-17 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: micromachine
@@ -129,7 +129,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
129
129
  - !ruby/object:Gem::Version
130
130
  version: 1.3.6
131
131
  requirements: []
132
- rubygems_version: 3.1.6
132
+ rubygems_version: 3.3.26
133
133
  signing_key:
134
134
  specification_version: 4
135
135
  summary: A Vagrant plugin to install the VirtualBoxAdditions into the guest VM