iesd 1.0.3 → 1.1.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/bin/iesd +45 -16
- data/iesd.gemspec +1 -1
- data/lib/iesd/InstallESD/BaseSystem.dmg.rb +12 -6
- data/lib/iesd/InstallESD/InstallESD.dmg.rb +21 -7
- data/lib/iesd/utility/hdiutil.rb +16 -9
- data/lib/iesd/utility/pkgutil.rb +1 -1
- metadata +8 -8
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: fb4d3cc64133af8167ed061b619cc907b529f08b
|
4
|
+
data.tar.gz: 84fd6d472f6e46bc9d8447bcb9531e4be18f22f0
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: dd9b62cf21516bbc29f1ebbadaa2cbf6fa7605e412660a94f271709b5ac3dc543c42a774892156caccecb5ec6b9bd0a7ebec33e27ba0afbb6a44b91569002d6e
|
7
|
+
data.tar.gz: d50a0b0af9cf6d710f995fb5e2228bb1fe97aea6ead280c39440b0d895e7a2f0fcc38ebcf7ac4db4b9ecd4ce947590ade597c4658abf146cd45b6ee51d79f7c2
|
data/bin/iesd
CHANGED
@@ -17,13 +17,20 @@ options = {
|
|
17
17
|
:input => nil,
|
18
18
|
:output => nil,
|
19
19
|
:type => nil,
|
20
|
+
:interactive => false,
|
21
|
+
:hdiutil => {
|
22
|
+
:resize => {
|
23
|
+
:grow => 0,
|
24
|
+
:shrink => false
|
25
|
+
}
|
26
|
+
},
|
27
|
+
:mach_kernel => nil,
|
20
28
|
:extensions => {
|
21
29
|
:install => [],
|
22
30
|
:remove => [],
|
23
31
|
:kextcache => nil,
|
24
32
|
:postinstall => true
|
25
|
-
}
|
26
|
-
:mach_kernel => nil
|
33
|
+
}
|
27
34
|
}
|
28
35
|
|
29
36
|
optparse = OptionParser.new do |opts|
|
@@ -33,48 +40,70 @@ optparse = OptionParser.new do |opts|
|
|
33
40
|
opts.separator "Specific options:"
|
34
41
|
|
35
42
|
opts.on("-i", "--input inputfile",
|
36
|
-
"
|
43
|
+
"Input file (dmg or app)") do |input|
|
37
44
|
options[:input] = File.absolute_path input
|
38
45
|
end
|
39
46
|
|
40
47
|
opts.on("-o", "--output outputfile",
|
41
|
-
"
|
48
|
+
"Output file (dmg)") do |output|
|
42
49
|
output << ".dmg" if File.extname(output).downcase != ".dmg"
|
43
50
|
options[:output] = File.absolute_path output
|
44
51
|
end
|
45
52
|
|
46
53
|
opts.on("-t", "--type type", [:BaseSystem, :InstallESD],
|
47
|
-
"
|
54
|
+
"Output type (BaseSystem, InstallESD)") do |type|
|
48
55
|
options[:type] = type
|
49
56
|
end
|
50
57
|
|
51
|
-
opts.on("
|
52
|
-
options[:
|
58
|
+
opts.on("-s", "--[no-]interactive-shell", "Edit in #{ENV["SHELL"]}") do |interactive|
|
59
|
+
options[:interactive] = interactive
|
60
|
+
end
|
61
|
+
|
62
|
+
opts.separator ""
|
63
|
+
opts.separator "HDIUtil options:"
|
64
|
+
|
65
|
+
opts.on("--grow sectors", OptionParser::DecimalInteger,
|
66
|
+
"Grow dmg size by number of sectors") do |sectors|
|
67
|
+
options[:hdiutil][:resize][:grow] = sectors
|
68
|
+
end
|
69
|
+
|
70
|
+
opts.on("--[no-]shrink", "Shrink output dmg") do |s|
|
71
|
+
options[:hdiutil][:resize][:shrink] = s
|
72
|
+
end
|
73
|
+
|
74
|
+
opts.separator ""
|
75
|
+
opts.separator "Boot options:"
|
76
|
+
|
77
|
+
opts.on("--[no-]kernel", "Use mach_kernel as fallback to kernelcache") do |k|
|
78
|
+
options[:mach_kernel] = k
|
53
79
|
end
|
54
80
|
|
55
|
-
opts.
|
81
|
+
opts.separator ""
|
82
|
+
opts.separator "Extension options:"
|
83
|
+
|
84
|
+
opts.on("--remove-kexts x.kext,y.kext,z.kext", Array, "Kexts to remove") do |list|
|
56
85
|
options[:extensions][:remove] = list
|
57
86
|
end
|
58
87
|
|
59
|
-
opts.on("--
|
60
|
-
options[:extensions][:
|
88
|
+
opts.on("--install-kexts x.kext,y.kext,z.kext", Array, "Kexts to install") do |list|
|
89
|
+
options[:extensions][:install] = list.map { |kext| File.absolute_path kext }
|
61
90
|
end
|
62
91
|
|
63
|
-
opts.on("--[no-]postinstall-kexts", "Patch OSInstall.pkg
|
92
|
+
opts.on("--[no-]postinstall-kexts", "Patch OSInstall.pkg to postinstall kexts") do |p|
|
64
93
|
options[:extensions][:postinstall] = p
|
65
94
|
end
|
66
95
|
|
67
|
-
opts.on("--[no-]
|
68
|
-
options[:
|
96
|
+
opts.on("--[no-]kextcache", "Rebuild kernelcache") do |c|
|
97
|
+
options[:extensions][:kextcache] = c
|
69
98
|
end
|
70
99
|
|
100
|
+
opts.separator ""
|
101
|
+
opts.separator "Common options:"
|
102
|
+
|
71
103
|
opts.on("-v", "--[no-]verbose", "Run verbosely") do |v|
|
72
104
|
ENV['VERBOSE'] = '1'
|
73
105
|
end
|
74
106
|
|
75
|
-
opts.separator ""
|
76
|
-
opts.separator "Common options:"
|
77
|
-
|
78
107
|
opts.on_tail("-h", "--help", "Show this message") do
|
79
108
|
puts opts
|
80
109
|
exit
|
data/iesd.gemspec
CHANGED
@@ -2,7 +2,7 @@ Gem::Specification.new do |s|
|
|
2
2
|
s.required_ruby_version = ">= 1.9.2"
|
3
3
|
|
4
4
|
s.name = "iesd"
|
5
|
-
s.version = "1.0
|
5
|
+
s.version = "1.1.0"
|
6
6
|
s.summary = "Customize OS X InstallESD."
|
7
7
|
s.description = "Modify Extensions, Kextcache and Packages on InstallESD."
|
8
8
|
s.authors = "なつき"
|
@@ -3,21 +3,27 @@ module IESD
|
|
3
3
|
class BaseSystem < HDIUtil::DMG
|
4
4
|
PACKAGES = %w{ System Installation Packages }
|
5
5
|
|
6
|
-
def export options
|
6
|
+
def export options
|
7
7
|
case options[:type]
|
8
8
|
when :BaseSystem, nil
|
9
9
|
Dir.mktmpdir { |tmp|
|
10
|
-
HDIUtil.write(@url, (tmpfile = File.join(tmp, File.basename(@url))),
|
10
|
+
HDIUtil.write(@url, (tmpfile = File.join(tmp, File.basename(@url))), options[:hdiutil]) { |volume_root|
|
11
11
|
options[:extensions][:up_to_date] = (options[:extensions][:remove].empty? and options[:extensions][:install].empty?)
|
12
12
|
options[:mach_kernel] = File.exist? File.join(volume_root, "mach_kernel") if options[:mach_kernel].nil?
|
13
13
|
|
14
14
|
yield volume_root if block_given?
|
15
15
|
|
16
|
-
|
16
|
+
pre_update_extension volume_root, options
|
17
17
|
|
18
18
|
IESD::DMG::BaseSystem::Extensions.new(volume_root).update options[:extensions]
|
19
19
|
|
20
|
-
|
20
|
+
post_update_extension volume_root, options
|
21
|
+
|
22
|
+
if options[:interactive]
|
23
|
+
oh1 "Starting Interactive Shell"
|
24
|
+
puts "Environment: BaseSystem"
|
25
|
+
HDIUtil.shell volume_root
|
26
|
+
end
|
21
27
|
}
|
22
28
|
system(Utility::MV, tmpfile, options[:output])
|
23
29
|
}
|
@@ -28,14 +34,14 @@ module IESD
|
|
28
34
|
|
29
35
|
private
|
30
36
|
|
31
|
-
def
|
37
|
+
def pre_update_extension volume_root, options
|
32
38
|
if !File.exist? (mach_kernel = File.join(volume_root, "mach_kernel")) and (options[:mach_kernel] or !options[:extensions][:up_to_date])
|
33
39
|
IESD::Packages::BaseSystemBinaries.new(File.join(volume_root, *PACKAGES, "BaseSystemBinaries.pkg")).extract_mach_kernel mach_kernel
|
34
40
|
system(Utility::CHFLAGS, "hidden", mach_kernel)
|
35
41
|
end
|
36
42
|
end
|
37
43
|
|
38
|
-
def
|
44
|
+
def post_update_extension volume_root, options
|
39
45
|
if !options[:extensions][:up_to_date] and options[:extensions][:postinstall]
|
40
46
|
IESD::Packages::OSInstall.new(File.join(volume_root, *PACKAGES, "OSInstall.pkg")).postinstall_extensions options[:extensions]
|
41
47
|
end
|
@@ -6,9 +6,17 @@ module IESD
|
|
6
6
|
def export options
|
7
7
|
case options[:type]
|
8
8
|
when :BaseSystem
|
9
|
-
|
9
|
+
options = {
|
10
|
+
:hdiutil => {
|
11
|
+
:resize => {
|
12
|
+
:grow => 0,
|
13
|
+
}
|
14
|
+
}
|
15
|
+
}.merge(options)
|
16
|
+
options[:hdiutil][:resize][:grow] += ( `#{Utility::HDIUTIL} resize -limits "#{@url}"`.chomp.split.map { |s| s.to_i } ).first
|
17
|
+
|
10
18
|
show { |installesd|
|
11
|
-
IESD::DMG::BaseSystem.new(File.join(installesd, "BaseSystem.dmg")).export(options
|
19
|
+
IESD::DMG::BaseSystem.new(File.join(installesd, "BaseSystem.dmg")).export(options) { |basesystem|
|
12
20
|
installesd_packages = File.join installesd, PACKAGES
|
13
21
|
basesystem_packages = File.join basesystem, *IESD::DMG::BaseSystem::PACKAGES
|
14
22
|
oh1 "Copying #{installesd_packages}"
|
@@ -28,13 +36,13 @@ module IESD
|
|
28
36
|
}
|
29
37
|
when :InstallESD, nil
|
30
38
|
Dir.mktmpdir { |tmp|
|
31
|
-
HDIUtil.write(@url, (tmpfile = File.join(tmp, File.basename(@url)))) { |installesd|
|
39
|
+
HDIUtil.write(@url, (tmpfile = File.join(tmp, File.basename(@url))), options[:hdiutil]) { |installesd|
|
32
40
|
options[:extensions][:up_to_date] = (options[:extensions][:remove].empty? and options[:extensions][:install].empty?)
|
33
41
|
options[:mach_kernel] = File.exist? File.join(installesd, "mach_kernel") if options[:mach_kernel].nil?
|
34
42
|
|
35
43
|
yield installesd if block_given?
|
36
44
|
|
37
|
-
|
45
|
+
pre_update_extension installesd, options
|
38
46
|
|
39
47
|
basesystem_options = options.clone
|
40
48
|
basesystem_options[:input] = basesystem_options[:output] = File.join(installesd, "BaseSystem.dmg")
|
@@ -60,7 +68,13 @@ module IESD
|
|
60
68
|
}
|
61
69
|
end
|
62
70
|
|
63
|
-
|
71
|
+
post_update_extension installesd, options
|
72
|
+
|
73
|
+
if options[:interactive]
|
74
|
+
oh1 "Starting Interactive Shell"
|
75
|
+
puts "Environment: InstallESD"
|
76
|
+
HDIUtil.shell installesd
|
77
|
+
end
|
64
78
|
}
|
65
79
|
system(Utility::MV, tmpfile, options[:output])
|
66
80
|
}
|
@@ -71,14 +85,14 @@ module IESD
|
|
71
85
|
|
72
86
|
private
|
73
87
|
|
74
|
-
def
|
88
|
+
def pre_update_extension volume_root, options
|
75
89
|
if !File.exist? (mach_kernel = File.join(volume_root, "mach_kernel")) and (options[:mach_kernel] or !options[:extensions][:up_to_date])
|
76
90
|
IESD::Packages::BaseSystemBinaries.new(File.join(volume_root, *PACKAGES, "BaseSystemBinaries.pkg")).extract_mach_kernel mach_kernel
|
77
91
|
system(Utility::CHFLAGS, "hidden", mach_kernel)
|
78
92
|
end
|
79
93
|
end
|
80
94
|
|
81
|
-
def
|
95
|
+
def post_update_extension volume_root, options
|
82
96
|
if !options[:extensions][:up_to_date] and options[:extensions][:postinstall]
|
83
97
|
IESD::Packages::OSInstall.new(File.join(volume_root, *PACKAGES, "OSInstall.pkg")).postinstall_extensions options[:extensions]
|
84
98
|
end
|
data/lib/iesd/utility/hdiutil.rb
CHANGED
@@ -1,5 +1,5 @@
|
|
1
1
|
module HDIUtil
|
2
|
-
DEFAULT_MOUNT_OPTIONS = %w{ -nobrowse -quiet -noverify}
|
2
|
+
DEFAULT_MOUNT_OPTIONS = %w{ -nobrowse -quiet -noverify }
|
3
3
|
DEFAULT_MOUNT_OPTIONS.concat(%w{ -owners on }) if Process.uid == 0
|
4
4
|
DEFAULT_UNMOUNT_OPTIONS = %w{ -quiet }
|
5
5
|
DEFAULT_CONVERT_OPTIONS = %w{ -quiet }
|
@@ -16,14 +16,21 @@ module HDIUtil
|
|
16
16
|
}
|
17
17
|
end
|
18
18
|
|
19
|
-
def self.write input, output,
|
19
|
+
def self.write input, output, options = {}
|
20
|
+
options = {
|
21
|
+
:resize => {
|
22
|
+
:grow => 0,
|
23
|
+
:shrink => false
|
24
|
+
}
|
25
|
+
}.merge(options)
|
26
|
+
|
20
27
|
Dir.mktmpdir { |tmp|
|
21
28
|
shadow = File.join(tmp, "#{File.basename input}.shadow")
|
22
29
|
shadow_options = ["-shadow", shadow]
|
23
30
|
format_options = ["-format", `#{Utility::HDIUTIL} imageinfo -format "#{input}"`.chomp]
|
24
31
|
Dir.mktmpdir(nil, tmp) { |mountpoint|
|
25
32
|
resize_limits = `#{Utility::HDIUTIL} resize -limits -shadow "#{shadow}" "#{input}"`.chomp.split.map { |s| s.to_i }
|
26
|
-
sectors = (resize_limits[1] +
|
33
|
+
sectors = (resize_limits[1] + options[:resize][:grow]).to_s
|
27
34
|
system(Utility::HDIUTIL, "resize", "-growonly", "-sectors", sectors, *shadow_options, input)
|
28
35
|
attach input, mountpoint, [*DEFAULT_MOUNT_OPTIONS, *shadow_options]
|
29
36
|
if block_given?
|
@@ -32,7 +39,7 @@ module HDIUtil
|
|
32
39
|
shell mountpoint
|
33
40
|
end
|
34
41
|
detach input, mountpoint, [*DEFAULT_UNMOUNT_OPTIONS]
|
35
|
-
system(Utility::HDIUTIL, "resize", "-shrinkonly", "-sectors", "min", *shadow_options, input)
|
42
|
+
system(Utility::HDIUTIL, "resize", "-shrinkonly", "-sectors", "min", *shadow_options, input) if options[:resize][:shrink]
|
36
43
|
}
|
37
44
|
oh1 "Merging #{shadow}"
|
38
45
|
system(Utility::HDIUTIL, "convert", *DEFAULT_CONVERT_OPTIONS, *format_options, *shadow_options, "-o", output, input)
|
@@ -46,22 +53,22 @@ module HDIUtil
|
|
46
53
|
|
47
54
|
private
|
48
55
|
|
49
|
-
def self.attach dmg, mountpoint,
|
56
|
+
def self.attach dmg, mountpoint, arguments = []
|
50
57
|
ohai "Mounting #{dmg}"
|
51
|
-
system(Utility::HDIUTIL, "attach", *
|
58
|
+
system(Utility::HDIUTIL, "attach", *arguments, "-mountpoint", mountpoint, dmg)
|
52
59
|
puts "Mounted: #{mountpoint}"
|
53
60
|
end
|
54
61
|
|
55
|
-
def self.detach dmg, mountpoint,
|
62
|
+
def self.detach dmg, mountpoint, arguments = []
|
56
63
|
ohai "Unmounting #{dmg}"
|
57
|
-
system(Utility::HDIUTIL, "detach", *
|
64
|
+
system(Utility::HDIUTIL, "detach", *arguments, mountpoint)
|
58
65
|
puts "Unmounted: #{mountpoint}"
|
59
66
|
end
|
60
67
|
|
61
68
|
def self.shell dir
|
62
69
|
Dir.chdir(dir) {
|
63
70
|
ohai ENV['SHELL']
|
64
|
-
system
|
71
|
+
Kernel.system ENV, ENV['SHELL']
|
65
72
|
}
|
66
73
|
end
|
67
74
|
end
|
data/lib/iesd/utility/pkgutil.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: iesd
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 1.0
|
4
|
+
version: 1.1.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- "なつき"
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2014-03-31 00:00:00.000000000 Z
|
12
12
|
dependencies: []
|
13
13
|
description: Modify Extensions, Kextcache and Packages on InstallESD.
|
14
14
|
email: i@ntk.me
|
@@ -17,26 +17,26 @@ executables:
|
|
17
17
|
extensions: []
|
18
18
|
extra_rdoc_files: []
|
19
19
|
files:
|
20
|
-
- README.md
|
21
20
|
- LICENSE.md
|
21
|
+
- README.md
|
22
22
|
- bin/iesd
|
23
23
|
- iesd.gemspec
|
24
|
+
- lib/iesd.rb
|
25
|
+
- lib/iesd/InstallESD.rb
|
24
26
|
- lib/iesd/InstallESD/BaseSystem.dmg.rb
|
25
27
|
- lib/iesd/InstallESD/Extensions.rb
|
26
28
|
- lib/iesd/InstallESD/InstallESD.dmg.rb
|
27
29
|
- lib/iesd/InstallESD/InstallOSX.app.rb
|
28
30
|
- lib/iesd/InstallESD/InstallOSX.dmg.rb
|
31
|
+
- lib/iesd/InstallESD/Packages.rb
|
29
32
|
- lib/iesd/InstallESD/Packages/BaseSystemBinaries.pkg.rb
|
30
33
|
- lib/iesd/InstallESD/Packages/OSInstall.mpkg.rb
|
31
34
|
- lib/iesd/InstallESD/Packages/OSInstall.pkg.rb
|
32
35
|
- lib/iesd/InstallESD/Packages/OSUpgrade.pkg.rb
|
33
|
-
- lib/iesd/
|
34
|
-
- lib/iesd/InstallESD.rb
|
36
|
+
- lib/iesd/utility.rb
|
35
37
|
- lib/iesd/utility/hdiutil.rb
|
36
38
|
- lib/iesd/utility/pkgutil.rb
|
37
39
|
- lib/iesd/utility/tty.rb
|
38
|
-
- lib/iesd/utility.rb
|
39
|
-
- lib/iesd.rb
|
40
40
|
homepage: https://github.com/ntkme/iesd
|
41
41
|
licenses:
|
42
42
|
- BSD-2-Clause
|
@@ -57,7 +57,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
57
57
|
version: '0'
|
58
58
|
requirements: []
|
59
59
|
rubyforge_project:
|
60
|
-
rubygems_version: 2.
|
60
|
+
rubygems_version: 2.2.2
|
61
61
|
signing_key:
|
62
62
|
specification_version: 4
|
63
63
|
summary: Customize OS X InstallESD.
|