macinbox 1.1.0 → 1.1.1
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 +11 -26
- data/lib/macinbox/actions/create_hdd_from_image.rb +114 -0
- data/lib/macinbox/actions/create_vmdk_from_image.rb +3 -3
- data/lib/macinbox/actions.rb +1 -1
- data/lib/macinbox/cli.rb +6 -6
- data/lib/macinbox/version.rb +1 -1
- data/macinbox.gemspec +0 -1
- metadata +3 -4
- data/lib/macinbox/actions/create_hdd_from_vmdk.rb +0 -49
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 5e8ada3102753fe30348667d4fbfb2e5aa178f39
|
4
|
+
data.tar.gz: 6bef79877bad0fde8bc350966ce45247053ce461
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 3cde4d8b3f4a76d5dc57239f499a0421f833fcd72e64a3db10a00f5b9aaab99d00edf10d9b1fd860a193ff724974ae11e2f1677627e734aa44e4257219698835
|
7
|
+
data.tar.gz: 4e463fe8c9daff3163aa27527f80993fe247fed5124aa162670cae896753e889e948770a73bf02707fb466e75c9f46e9838dec59f4af50e0a1b19720b7fb3564
|
data/Gemfile.lock
CHANGED
data/README.md
CHANGED
@@ -14,37 +14,24 @@ Supports creating boxes in either the 'vmware_fusion' or 'parallels' formats.
|
|
14
14
|
* macOS 10.13 High Sierra host operating system
|
15
15
|
* At least 8 GB RAM (16 GB recommended)
|
16
16
|
* At least 2 cores (4 recommended)
|
17
|
-
* At least
|
17
|
+
* At least 100 GB of available disk space
|
18
18
|
|
19
19
|
## Dependencies
|
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.0.3
|
23
|
+
* [macOS 10.13.4 High Sierra installer application](http://appstore.com/mac/macoshighsierra)
|
24
|
+
* [Vagrant 2.0.3](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.1
|
29
|
-
* Vagrant VMware Fusion Provider 5.0.4
|
28
|
+
* [VMware Fusion Pro 10.1.1](http://www.vmware.com/products/fusion.html)
|
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:
|
32
32
|
|
33
|
-
*
|
34
|
-
* Parallels
|
35
|
-
* Vagrant Parallels Provider 1.7.8
|
36
|
-
|
37
|
-
[Get macOS 10.13 High Sierra installer application](http://appstore.com/mac/macoshighsierra)
|
38
|
-
//
|
39
|
-
[Get Vagrant](https://www.vagrantup.com/)
|
40
|
-
//
|
41
|
-
[Get VMware Fusion](http://www.vmware.com/products/fusion.html)
|
42
|
-
//
|
43
|
-
[Get Vagrant VMware Fusion Provider](https://www.vagrantup.com/vmware/)
|
44
|
-
//
|
45
|
-
[Get Parallels Desktop](https://www.parallels.com/products/desktop/)
|
46
|
-
//
|
47
|
-
[Get Vagrant Parallels Provider](https://parallels.github.io/vagrant-parallels/)
|
33
|
+
* [Parallels Desktop 13 for Mac Pro Edition 13.3.0](https://www.parallels.com/products/desktop/)
|
34
|
+
* [Vagrant Parallels Provider 1.7.8](https://parallels.github.io/vagrant-parallels/)
|
48
35
|
|
49
36
|
## Installation
|
50
37
|
|
@@ -115,23 +102,21 @@ By default `macinbox` will configure the guest OS to have HiDPI resolutions enab
|
|
115
102
|
|
116
103
|
By default `macinbox` will create a Vagrant box in the 'vmware_fusion' format with the VMware Tools pre-installed. When the box format is set to 'parallels' using the `--box-format` option then the Parallels Tools are pre-installed instead.
|
117
104
|
|
118
|
-
**Note:** Creating a 'parallels' box requires **both** VMware Fusion and Parallels Desktop to be installed.
|
119
|
-
|
120
105
|
## Implementation Details
|
121
106
|
|
122
107
|
This tool performs the following actions:
|
123
108
|
|
124
109
|
1. Creates a new blank disk image
|
125
110
|
1. Installs macOS
|
126
|
-
1. Installs the VMware tools
|
127
|
-
1. Updates the SystemPolicyConfiguration KextPolicy to allow the VMware tools kernel extension to load automatically
|
111
|
+
1. Installs the VMware or Parallels tools
|
112
|
+
1. (VMware only) Updates the SystemPolicyConfiguration KextPolicy to allow the VMware tools kernel extension to load automatically
|
128
113
|
1. Adds an .InstallerConfiguration file to automate the Setup Assistant app and create a user account on first boot
|
129
114
|
1. Enables password-less sudo
|
130
115
|
1. Enables sshd
|
131
116
|
1. Adds an rc.installer_cleanup script which waits for the user account to be created on first boot and then installs the default insecure Vagrant SSH key in the user's home directory
|
132
117
|
1. Enables HiDPI resolutions
|
133
|
-
1. Converts the image into a
|
134
|
-
1. Creates a Vagrant box
|
118
|
+
1. Converts the image into a virtual hard disk
|
119
|
+
1. Creates a Vagrant box using the virtual hard disk
|
135
120
|
1. Adds the box to Vagrant
|
136
121
|
|
137
122
|
|
@@ -0,0 +1,114 @@
|
|
1
|
+
require 'fileutils'
|
2
|
+
require 'shellwords'
|
3
|
+
|
4
|
+
require 'macinbox/error'
|
5
|
+
require 'macinbox/logger'
|
6
|
+
require 'macinbox/task'
|
7
|
+
|
8
|
+
module Macinbox
|
9
|
+
|
10
|
+
module Actions
|
11
|
+
|
12
|
+
class CreateHDDFromImage
|
13
|
+
|
14
|
+
def initialize(opts)
|
15
|
+
@input_image = opts[:image_path] or raise ArgumentError.new(":image_path not specified")
|
16
|
+
@output_path = opts[:hdd_path] or raise ArgumentError.new(":hdd_path not specified")
|
17
|
+
@parallels_app = opts[:parallels_path] or raise ArgumentError.new(":parallels_path not specified")
|
18
|
+
|
19
|
+
@collector = opts[:collector] or raise ArgumentError.new(":collector not specified")
|
20
|
+
@debug = opts[:debug]
|
21
|
+
|
22
|
+
raise Macinbox::Error.new("input image not found") unless File.exist? @input_image
|
23
|
+
raise Macinbox::Error.new("Parallels Desktop not found") unless File.exist? @parallels_app
|
24
|
+
end
|
25
|
+
|
26
|
+
def run
|
27
|
+
@temp_dir = Task.backtick %W[ /usr/bin/mktemp -d -t create_hdd_from_image ]
|
28
|
+
@collector.add_temp_dir @temp_dir
|
29
|
+
|
30
|
+
Logger.info "Attaching the image..." do
|
31
|
+
|
32
|
+
@collector.on_cleanup do
|
33
|
+
%x( diskutil eject #{@device.shellescape} > /dev/null 2>&1 ) if @device
|
34
|
+
end
|
35
|
+
|
36
|
+
@device = %x(
|
37
|
+
hdiutil attach #{@input_image.shellescape} -nomount |
|
38
|
+
grep _partition_scheme |
|
39
|
+
cut -f1 |
|
40
|
+
tr -d [:space:]
|
41
|
+
)
|
42
|
+
|
43
|
+
raise Macinbox::Error.new("failed to attach the image") unless File.exist? @device
|
44
|
+
end
|
45
|
+
|
46
|
+
Logger.info "Converting the image to HDD format..." do
|
47
|
+
|
48
|
+
disk_info = Task.backtick %W[ fdisk #{@device} ]
|
49
|
+
|
50
|
+
geometry_re = /geometry: (\d+)\/(\d+)\/(\d+) \[(\d+) sectors\]/
|
51
|
+
|
52
|
+
match = geometry_re.match(disk_info)
|
53
|
+
|
54
|
+
raise Macinbox::Error.new("failed to determine disk geometry") if match.nil? || match.captures.length != 4
|
55
|
+
|
56
|
+
device_sectors = match.captures[3]
|
57
|
+
|
58
|
+
device_cylinders = match.captures[0]
|
59
|
+
device_heads_per_track = match.captures[1]
|
60
|
+
device_sectors_per_track = match.captures[2]
|
61
|
+
|
62
|
+
bios_cylinders = 1024
|
63
|
+
bios_heads_per_track = device_heads_per_track
|
64
|
+
bios_sectors_per_track = device_sectors_per_track
|
65
|
+
|
66
|
+
File.write "#{@temp_dir}/macinbox.vmdk", <<~EOF
|
67
|
+
# Disk DescriptorFile
|
68
|
+
version=1
|
69
|
+
encoding="UTF-8"
|
70
|
+
CID=fffffffe
|
71
|
+
parentCID=ffffffff
|
72
|
+
isNativeSnapshot="no"
|
73
|
+
createType="monolithicFlat"
|
74
|
+
|
75
|
+
# Extent description
|
76
|
+
RW #{device_sectors} FLAT "#{@device}" 0
|
77
|
+
|
78
|
+
# The Disk Data Base
|
79
|
+
#DDB
|
80
|
+
|
81
|
+
ddb.adapterType = "lsilogic"
|
82
|
+
ddb.deletable = "true"
|
83
|
+
ddb.geometry.biosCylinders = "#{bios_cylinders}"
|
84
|
+
ddb.geometry.biosHeads = "#{bios_heads_per_track}"
|
85
|
+
ddb.geometry.biosSectors = "#{bios_sectors_per_track}"
|
86
|
+
ddb.geometry.cylinders = "#{device_cylinders}"
|
87
|
+
ddb.geometry.heads = "#{device_heads_per_track}"
|
88
|
+
ddb.geometry.sectors = "#{device_sectors_per_track}"
|
89
|
+
ddb.longContentID = "9fa218b506cfe68615c39994fffffffe"
|
90
|
+
ddb.uuid = "60 00 C2 99 91 76 dd 77-6e 0d 84 8b b0 24 6e 00"
|
91
|
+
ddb.virtualHWVersion = "14"
|
92
|
+
EOF
|
93
|
+
|
94
|
+
prl_convert = "#{@parallels_app}/Contents/MacOS/prl_convert"
|
95
|
+
task_opts = @debug ? {} : { :out => File::NULL }
|
96
|
+
Task.run %W[ #{prl_convert} #{@temp_dir}/macinbox.vmdk --allow-no-os --dst=#{@temp_dir} ] + [task_opts]
|
97
|
+
|
98
|
+
end
|
99
|
+
|
100
|
+
Logger.info "Moving the HDD to the destination..." do
|
101
|
+
FileUtils.chown_R ENV["SUDO_USER"], nil, "#{@temp_dir}/macinbox.hdd"
|
102
|
+
FileUtils.mv "#{@temp_dir}/macinbox.hdd", @output_path
|
103
|
+
end
|
104
|
+
|
105
|
+
Task.run %W[ diskutil eject #{@device.shellescape} ]
|
106
|
+
@device = nil
|
107
|
+
|
108
|
+
end
|
109
|
+
|
110
|
+
end
|
111
|
+
|
112
|
+
end
|
113
|
+
|
114
|
+
end
|
@@ -27,7 +27,7 @@ module Macinbox
|
|
27
27
|
@temp_dir = Task.backtick %W[ /usr/bin/mktemp -d -t create_vmdk_from_image ]
|
28
28
|
@collector.add_temp_dir @temp_dir
|
29
29
|
|
30
|
-
Logger.info "
|
30
|
+
Logger.info "Attaching the image..." do
|
31
31
|
|
32
32
|
@collector.on_cleanup do
|
33
33
|
%x( diskutil eject #{@device.shellescape} > /dev/null 2>&1 ) if @device
|
@@ -40,14 +40,14 @@ module Macinbox
|
|
40
40
|
tr -d [:space:]
|
41
41
|
)
|
42
42
|
|
43
|
-
raise Macinbox::Error.new("failed to
|
43
|
+
raise Macinbox::Error.new("failed to attach the image") unless File.exist? @device
|
44
44
|
end
|
45
45
|
|
46
46
|
Logger.info "Converting the image to VMDK format..." do
|
47
47
|
rawdiskCreator = "#{@vmware_fusion_app}/Contents/Library/vmware-rawdiskCreator"
|
48
48
|
vdiskmanager = "#{@vmware_fusion_app}/Contents/Library/vmware-vdiskmanager"
|
49
49
|
Dir.chdir(@temp_dir) do
|
50
|
-
Task.run %W[ #{rawdiskCreator} create
|
50
|
+
Task.run %W[ #{rawdiskCreator} create #{@device} fullDevice rawdisk lsilogic ]
|
51
51
|
Task.run %W[ #{vdiskmanager} -t 0 -r rawdisk.vmdk macinbox.vmdk ]
|
52
52
|
end
|
53
53
|
Task.run %W[ diskutil eject #{@device.shellescape} ]
|
data/lib/macinbox/actions.rb
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
require "macinbox/actions/create_box_from_hdd"
|
2
2
|
require "macinbox/actions/create_box_from_vmdk"
|
3
|
-
require "macinbox/actions/
|
3
|
+
require "macinbox/actions/create_hdd_from_image"
|
4
4
|
require "macinbox/actions/create_image_from_installer"
|
5
5
|
require "macinbox/actions/create_vmdk_from_image"
|
6
6
|
require "macinbox/actions/install_box"
|
data/lib/macinbox/cli.rb
CHANGED
@@ -89,22 +89,22 @@ module Macinbox
|
|
89
89
|
Actions::CreateImageFromInstaller.new(@options).run
|
90
90
|
end
|
91
91
|
|
92
|
-
Logger.info "Creating VMDK from image..." do
|
93
|
-
Actions::CreateVMDKFromImage.new(@options).run
|
94
|
-
end
|
95
|
-
|
96
92
|
case @options[:box_format]
|
97
93
|
|
98
94
|
when "vmware_fusion"
|
99
95
|
|
96
|
+
Logger.info "Creating VMDK from image..." do
|
97
|
+
Actions::CreateVMDKFromImage.new(@options).run
|
98
|
+
end
|
99
|
+
|
100
100
|
Logger.info "Creating box from VMDK..." do
|
101
101
|
Actions::CreateBoxFromVMDK.new(@options).run
|
102
102
|
end
|
103
103
|
|
104
104
|
when "parallels"
|
105
105
|
|
106
|
-
Logger.info "Creating HDD from
|
107
|
-
Actions::
|
106
|
+
Logger.info "Creating HDD from image..." do
|
107
|
+
Actions::CreateHDDFromImage.new(@options).run
|
108
108
|
end
|
109
109
|
|
110
110
|
Logger.info "Creating box from HDD..." do
|
data/lib/macinbox/version.rb
CHANGED
data/macinbox.gemspec
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.1.
|
4
|
+
version: 1.1.1
|
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-04-
|
11
|
+
date: 2018-04-23 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: bundler
|
@@ -60,7 +60,7 @@ files:
|
|
60
60
|
- lib/macinbox/actions.rb
|
61
61
|
- lib/macinbox/actions/create_box_from_hdd.rb
|
62
62
|
- lib/macinbox/actions/create_box_from_vmdk.rb
|
63
|
-
- lib/macinbox/actions/
|
63
|
+
- lib/macinbox/actions/create_hdd_from_image.rb
|
64
64
|
- lib/macinbox/actions/create_image_from_installer.rb
|
65
65
|
- lib/macinbox/actions/create_vmdk_from_image.rb
|
66
66
|
- lib/macinbox/actions/install_box.rb
|
@@ -95,7 +95,6 @@ requirements:
|
|
95
95
|
- macOS High Sierra
|
96
96
|
- macOS High Sierra installer app
|
97
97
|
- Vagrant
|
98
|
-
- VMware Fusion
|
99
98
|
rubyforge_project:
|
100
99
|
rubygems_version: 2.5.2
|
101
100
|
signing_key:
|
@@ -1,49 +0,0 @@
|
|
1
|
-
require 'fileutils'
|
2
|
-
require 'shellwords'
|
3
|
-
|
4
|
-
require 'macinbox/error'
|
5
|
-
require 'macinbox/logger'
|
6
|
-
require 'macinbox/task'
|
7
|
-
|
8
|
-
module Macinbox
|
9
|
-
|
10
|
-
module Actions
|
11
|
-
|
12
|
-
class CreateHDDFromVMDK
|
13
|
-
|
14
|
-
def initialize(opts)
|
15
|
-
@input_image = opts[:vmdk_path] or raise ArgumentError.new(":vmdk_path not specified")
|
16
|
-
@output_path = opts[:hdd_path] or raise ArgumentError.new(":hdd_path not specified")
|
17
|
-
@app_path = opts[:parallels_path] or raise ArgumentError.new(":parallels_path not specified")
|
18
|
-
|
19
|
-
@collector = opts[:collector] or raise ArgumentError.new(":collector not specified")
|
20
|
-
@debug = opts[:debug]
|
21
|
-
|
22
|
-
raise Macinbox::Error.new("input image not found") unless File.exist? @input_image
|
23
|
-
raise Macinbox::Error.new("Parallels not found") unless File.exist? @app_path
|
24
|
-
end
|
25
|
-
|
26
|
-
def run
|
27
|
-
@temp_dir = Task.backtick %W[ /usr/bin/mktemp -d -t create_hdd_from_vmdk ]
|
28
|
-
@collector.add_temp_dir @temp_dir
|
29
|
-
|
30
|
-
Logger.info "Converting the VMDK to HDD format..." do
|
31
|
-
prl_convert = "#{@app_path}/Contents/MacOS/prl_convert"
|
32
|
-
prl_disk_tool = "#{@app_path}/Contents/MacOS/prl_disk_tool"
|
33
|
-
task_opts = @debug ? {} : { :out => File::NULL }
|
34
|
-
Task.run %W[ #{prl_convert} #{@input_image} --allow-no-os --dst=#{@temp_dir} ] + [task_opts]
|
35
|
-
end
|
36
|
-
|
37
|
-
Logger.info "Moving the HDD to the destination..." do
|
38
|
-
hdd_name = "#{File.basename(@input_image, ".*")}.hdd"
|
39
|
-
FileUtils.chown_R ENV["SUDO_USER"], nil, "#{@temp_dir}/#{hdd_name}"
|
40
|
-
FileUtils.mv "#{@temp_dir}/#{hdd_name}", @output_path
|
41
|
-
end
|
42
|
-
|
43
|
-
end
|
44
|
-
|
45
|
-
end
|
46
|
-
|
47
|
-
end
|
48
|
-
|
49
|
-
end
|