macinbox 1.1.1 → 1.2.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Gemfile.lock +1 -1
- data/README.md +4 -3
- data/lib/macinbox/actions/create_image_from_installer.rb +17 -2
- data/lib/macinbox/cli/options.rb +2 -0
- data/lib/macinbox/task.rb +1 -1
- data/lib/macinbox/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 3f7eedd95d1b6f920f6cd85bfa88b3956ec05ac8
|
4
|
+
data.tar.gz: 023520243d7e43ef22b124cb5f83f3d983f586cc
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3f93f92954238ea9a1a4944c9ceebbb73dc3dcf51bd016346cf4dc1a36f6df92afe628c27d19afc9f4f6aada44f00d6e9840626ab34d937b9259aa593cccad3b
|
7
|
+
data.tar.gz: 7757b07da2ddbf71e088e7fdad810b01fe05de659b823a8a389b9cf6b3458e55364101a8aaeda238c78a0195420d07456087a2f0f54165c9d0a202bb041eebc9
|
data/Gemfile.lock
CHANGED
data/README.md
CHANGED
@@ -20,12 +20,12 @@ Supports creating boxes in either the 'vmware_fusion' or 'parallels' formats.
|
|
20
20
|
|
21
21
|
The following software is required. Versions other than those mentioned may work, but these are the latest versions tested:
|
22
22
|
|
23
|
-
* [macOS 10.13.
|
24
|
-
* [Vagrant 2.
|
23
|
+
* [macOS 10.13.5 High Sierra installer application](http://appstore.com/mac/macoshighsierra)
|
24
|
+
* [Vagrant 2.1.1](https://www.vagrantup.com/)
|
25
25
|
|
26
26
|
To create and boot a box in the 'vmware_fusion' format you must also have:
|
27
27
|
|
28
|
-
* [VMware Fusion Pro 10.1.
|
28
|
+
* [VMware Fusion Pro 10.1.2](http://www.vmware.com/products/fusion.html)
|
29
29
|
* [Vagrant VMware Fusion Provider 5.0.4](https://www.vagrantup.com/vmware/)
|
30
30
|
|
31
31
|
To create and boot a box in the 'parallels' format you must also have:
|
@@ -66,6 +66,7 @@ Usage: macinbox [options]
|
|
66
66
|
|
67
67
|
-n, --name NAME Name of the box (default: macinbox)
|
68
68
|
-d, --disk SIZE Size (GB) of the disk (default: 64)
|
69
|
+
-t, --fstype TYPE Type for disk format (default: HFS+J)
|
69
70
|
-m, --memory SIZE Size (MB) of the memory (default: 2048)
|
70
71
|
-c, --cpu COUNT Number of virtual cores (default: 2)
|
71
72
|
-s, --short NAME Short name of the user (default: vagrant)
|
@@ -19,6 +19,7 @@ module Macinbox
|
|
19
19
|
@parallels_app = opts[:parallels_path]
|
20
20
|
|
21
21
|
@disk_size = opts[:disk_size] or raise ArgumentError.new(":disk_size not specified")
|
22
|
+
@fstype = opts[:fstype] or raise ArgumentError.new(":fstype not specified")
|
22
23
|
@short_name = opts[:short_name] or raise ArgumentError.new(":short_name not specified")
|
23
24
|
@full_name = opts[:full_name] or raise ArgumentError.new(":full_name not specified")
|
24
25
|
@password = opts[:password] or raise ArgumentError.new(":password not specified")
|
@@ -95,7 +96,7 @@ module Macinbox
|
|
95
96
|
@scratch_image = "#{@temp_dir}/scratch.sparseimage"
|
96
97
|
FileUtils.mkdir @scratch_mountpoint
|
97
98
|
quiet_flag = @debug ? [] : %W[ -quiet ]
|
98
|
-
Task.run %W[ hdiutil create -size #{@disk_size}g -type SPARSE -fs
|
99
|
+
Task.run %W[ hdiutil create -size #{@disk_size}g -type SPARSE -fs #{@fstype} -volname #{"Macintosh HD"} -uid 0 -gid 80 -mode 1775 #{@scratch_image} ] + quiet_flag
|
99
100
|
Task.run %W[ hdiutil attach #{@scratch_image} -mountpoint #{@scratch_mountpoint} -nobrowse -owners on ] + quiet_flag
|
100
101
|
end
|
101
102
|
end
|
@@ -340,7 +341,21 @@ module Macinbox
|
|
340
341
|
|
341
342
|
def save_image
|
342
343
|
Logger.info "Saving the image..." do
|
343
|
-
|
344
|
+
# detaching sometimes fails at first so we pause to let the disk
|
345
|
+
# quiesce and then retry again a few times before giving up
|
346
|
+
max_attempts = 5
|
347
|
+
for attempt in 1..max_attempts
|
348
|
+
begin
|
349
|
+
Logger.info "Detaching the image..." if @debug
|
350
|
+
quiet_flag = @debug ? [] : %W[ -quiet ]
|
351
|
+
Task.run %W[ hdiutil detach #{@scratch_mountpoint} ] + quiet_flag
|
352
|
+
break
|
353
|
+
rescue Macinbox::Error => error
|
354
|
+
raise if attempt == max_attempts
|
355
|
+
Logger.info "#{error.message}. Sleeping and retrying..." if @debug
|
356
|
+
sleep 15
|
357
|
+
end
|
358
|
+
end
|
344
359
|
FileUtils.mv @scratch_image, "#{@temp_dir}/macinbox.dmg"
|
345
360
|
FileUtils.chown ENV["SUDO_USER"], nil, "#{@temp_dir}/macinbox.dmg"
|
346
361
|
FileUtils.mv "#{@temp_dir}/macinbox.dmg", @output_path
|
data/lib/macinbox/cli/options.rb
CHANGED
@@ -10,6 +10,7 @@ module Macinbox
|
|
10
10
|
:box_format => "vmware_fusion",
|
11
11
|
:box_name => "macinbox",
|
12
12
|
:disk_size => 64,
|
13
|
+
:fstype => "HFS+J",
|
13
14
|
:memory_size => 2048,
|
14
15
|
:cpu_count => 2,
|
15
16
|
:short_name => "vagrant",
|
@@ -36,6 +37,7 @@ module Macinbox
|
|
36
37
|
o.separator ''
|
37
38
|
o.on('-n', '--name NAME', 'Name of the box (default: macinbox)') { |v| @options[:box_name] = v }
|
38
39
|
o.on('-d', '--disk SIZE', 'Size (GB) of the disk (default: 64)') { |v| @options[:disk_size] = v }
|
40
|
+
o.on('-t', '--fstype TYPE', 'Type of FS on the disk (default: HFS+J)') { |v| @options[:fstype] = v }
|
39
41
|
o.on('-m', '--memory SIZE', 'Size (MB) of the memory (default: 2048)') { |v| @options[:memory_size] = v }
|
40
42
|
o.on('-c', '--cpu COUNT', 'Number of virtual cores (default: 2)') { |v| @options[:cpu_count] = v }
|
41
43
|
o.on('-s', '--short NAME', 'Short name of the user (default: vagrant)') { |v| @options[:short_name] = v }
|
data/lib/macinbox/task.rb
CHANGED
@@ -7,7 +7,7 @@ module Macinbox
|
|
7
7
|
class Task
|
8
8
|
|
9
9
|
def self.run(cmd)
|
10
|
-
system(*cmd) or raise Macinbox::Error.new("#{cmd.slice(0)} failed with non-zero exit code: #{
|
10
|
+
system(*cmd) or raise Macinbox::Error.new("#{cmd.slice(0)} failed with non-zero exit code: #{$? >> 8}")
|
11
11
|
end
|
12
12
|
|
13
13
|
def self.run_as_sudo_user(cmd)
|
data/lib/macinbox/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: macinbox
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.
|
4
|
+
version: 1.2.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- David Kramer
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2018-
|
11
|
+
date: 2018-06-09 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|