hackmac 0.6.2 → 0.8.3

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: 71ae7818b5eb86ace5700578ab7d49f071f53d6b5f34e11fcf01d97bf08e72ff
4
- data.tar.gz: bad5cd7a0889cf7428c146e4b0024f3c724bf261002aea14084b783f43426b53
3
+ metadata.gz: bb9a09c4a8c36db0e881489bb115887d6f9d3141c16799b957417f507c4b70fa
4
+ data.tar.gz: 67df1404193ff6557bab90512f3b732a5ca7f90d10020e3a856ad492d17fcd15
5
5
  SHA512:
6
- metadata.gz: d971877be07e1c4b1d0c153b437afd0e5eadfe8c48dd9181288b5067ee55456152e64ea3c3d6d4b49ad6d0a409e7d0c89bbacf022cac4ad900f1cb0ed64ab314
7
- data.tar.gz: 66c402c45ecb4fae5b1137ea2483907b71a826b5a20a36b22bedaafbe1e529cb3dd697a58da5d0d3a61658384efc357e667e8476cf9383979b0ce3a7eaaeef4d
6
+ metadata.gz: 44a4fd40a4a3c5aeef28c438d6bb4fefb75e3f2368a8c7df9059ed4546eaa126db131be345b71e19d70df2a42aa1146e3d4d0ea8a0b7f799d0ee395568ce5e98
7
+ data.tar.gz: 8f9fba1a5922e5c199771165be59ece57d3872ed45e767ec9c61b638e41956c858a0627c8dc45f9b81a68c2eb5df7c8e7eb94c9cfd64b31df96c6dc7df794840
data/VERSION CHANGED
@@ -1 +1 @@
1
- 0.6.2
1
+ 0.8.3
data/bin/efi CHANGED
@@ -21,7 +21,7 @@ end
21
21
  def boot_dev
22
22
  unless @boot_dev
23
23
  value = x(%{bdmesg}, verbose: false).lines.
24
- find { |l| l =~ /SelfDevicePath=(.*)\r/ and break $1 }
24
+ find { |l| l =~ /SelfDevicePath=(.*)\r?\n/ and break $1 }
25
25
  uuid = value.split('\\').last[/(?:<?GPT,)([\h-]+)/, 1] or exit 1
26
26
  @boot_dev = x(%{partutil --search-uuid #{uuid}}).chomp
27
27
  end
@@ -180,9 +180,11 @@ when 'kexts'
180
180
  }.pack
181
181
  when 'kext'
182
182
  path = ARGV.shift or fail 'need kext dir'
183
+ path = Pathname.new(path).expand_path.to_s
183
184
  puts Kext.new(path: path)
184
185
  when 'kext_upgrade'
185
186
  path = ARGV.shift or fail 'need kext dir'
187
+ path = Pathname.new(path).expand_path.to_s
186
188
  force = ARGV.shift == 'force'
187
189
  Hackmac::KextUpgrader.new(path: path, config: $config, force: force).perform
188
190
  when 'list'
@@ -199,6 +201,9 @@ when 'list'
199
201
  e.Volumes =
200
202
  ContainerDisk.new(disk: e.ParentWholeDisk, limiter: 'internal').VolumesFromDisks
201
203
  end
204
+ aliases = $config.devices.to_h.each_with_object({}) do |(dk,dv),h|
205
+ h[dv[:name]] = dk
206
+ end
202
207
  puts Tabulo::Table.new(efis, align_header: :left, border: :modern) { |t|
203
208
  t.add_column(
204
209
  :Booted,
@@ -206,6 +211,7 @@ when 'list'
206
211
  header_styler: bold_head
207
212
  ) { |e| e.Booted ? ?☑ : ?☐ }
208
213
  t.add_column(:VolumeName, header_styler: bold_head)
214
+ t.add_column(:Alias, header_styler: bold_head) { |e| aliases[e.VolumeName] }
209
215
  t.add_column(:DeviceIdentifier, header_styler: bold_head)
210
216
  t.add_column(:ParentWholeDisk, header_styler: bold_head)
211
217
  t.add_column(:Volumes, header_styler: bold_head) { |e| e.Volumes * ?, }
data/hackmac.gemspec CHANGED
@@ -1,22 +1,22 @@
1
1
  # -*- encoding: utf-8 -*-
2
- # stub: hackmac 0.6.2 ruby lib
2
+ # stub: hackmac 0.8.3 ruby lib
3
3
 
4
4
  Gem::Specification.new do |s|
5
5
  s.name = "hackmac".freeze
6
- s.version = "0.6.2"
6
+ s.version = "0.8.3"
7
7
 
8
8
  s.required_rubygems_version = Gem::Requirement.new(">= 0".freeze) if s.respond_to? :required_rubygems_version=
9
9
  s.require_paths = ["lib".freeze]
10
10
  s.authors = ["Florian Frank".freeze]
11
- s.date = "2020-05-15"
11
+ s.date = "2021-03-05"
12
12
  s.description = "This ruby gem provides some useful tools for working with a Hackintosh.".freeze
13
13
  s.email = "flori@ping.de".freeze
14
14
  s.executables = ["gfxmon".freeze, "usb".freeze, "efi".freeze]
15
- s.extra_rdoc_files = ["README.md".freeze, "lib/hackmac.rb".freeze, "lib/hackmac/config.rb".freeze, "lib/hackmac/disks.rb".freeze, "lib/hackmac/kext.rb".freeze, "lib/hackmac/kext_source.rb".freeze, "lib/hackmac/kext_upgrader.rb".freeze, "lib/hackmac/plist.rb".freeze, "lib/hackmac/utils.rb".freeze, "lib/hackmac/version.rb".freeze]
16
- s.files = [".gitignore".freeze, "Gemfile".freeze, "README.md".freeze, "Rakefile".freeze, "VERSION".freeze, "bin/efi".freeze, "bin/gfxmon".freeze, "bin/usb".freeze, "hackmac.gemspec".freeze, "lib/hackmac.rb".freeze, "lib/hackmac/config.rb".freeze, "lib/hackmac/disks.rb".freeze, "lib/hackmac/kext.rb".freeze, "lib/hackmac/kext_source.rb".freeze, "lib/hackmac/kext_upgrader.rb".freeze, "lib/hackmac/plist.rb".freeze, "lib/hackmac/utils.rb".freeze, "lib/hackmac/version.rb".freeze]
15
+ s.extra_rdoc_files = ["README.md".freeze, "lib/hackmac.rb".freeze, "lib/hackmac/config.rb".freeze, "lib/hackmac/disks.rb".freeze, "lib/hackmac/kext.rb".freeze, "lib/hackmac/kext_download.rb".freeze, "lib/hackmac/kext_source.rb".freeze, "lib/hackmac/kext_upgrader.rb".freeze, "lib/hackmac/plist.rb".freeze, "lib/hackmac/utils.rb".freeze, "lib/hackmac/version.rb".freeze]
16
+ s.files = [".gitignore".freeze, "Gemfile".freeze, "README.md".freeze, "Rakefile".freeze, "VERSION".freeze, "bin/efi".freeze, "bin/gfxmon".freeze, "bin/usb".freeze, "hackmac.gemspec".freeze, "lib/hackmac.rb".freeze, "lib/hackmac/config.rb".freeze, "lib/hackmac/disks.rb".freeze, "lib/hackmac/kext.rb".freeze, "lib/hackmac/kext_download.rb".freeze, "lib/hackmac/kext_source.rb".freeze, "lib/hackmac/kext_upgrader.rb".freeze, "lib/hackmac/plist.rb".freeze, "lib/hackmac/utils.rb".freeze, "lib/hackmac/version.rb".freeze]
17
17
  s.homepage = "http://github.com/flori/hackmac".freeze
18
18
  s.rdoc_options = ["--title".freeze, "Hackmac - Some useful tools for working with a Hackintosh".freeze, "--main".freeze, "README.md".freeze]
19
- s.rubygems_version = "3.1.2".freeze
19
+ s.rubygems_version = "3.1.4".freeze
20
20
  s.summary = "Some useful tools for working with a Hackintosh".freeze
21
21
 
22
22
  if s.respond_to? :specification_version then
data/lib/hackmac.rb CHANGED
@@ -2,12 +2,14 @@ module Hackmac
2
2
  end
3
3
 
4
4
  require 'json'
5
+ require 'pathname'
5
6
  require 'tins/xt'
6
7
  require 'hackmac/version'
7
8
  require 'hackmac/plist'
8
9
  require 'hackmac/disks'
9
10
  require 'hackmac/kext'
10
11
  require 'hackmac/kext_source'
12
+ require 'hackmac/kext_download'
11
13
  require 'hackmac/kext_upgrader'
12
14
  require 'hackmac/config'
13
15
  require 'hackmac/utils'
@@ -15,14 +15,14 @@ module Hackmac
15
15
  os: '/Applications/Install macOS Mojave.app'
16
16
  devices:
17
17
  main:
18
- name: EFI
19
- #backup:
20
- # name: BACKUP_EFI
18
+ name: 'OSX_EFI'
19
+ backup:
20
+ name: 'BACKUP_EFI'
21
21
  github:
22
22
  user: null
23
23
  access_token: null
24
24
  kext:
25
- efi_path: EFI/CLOVER/kexts/Other
25
+ efi_path: 'EFI/CLOVER/kexts/Other'
26
26
  sources:
27
27
  AppleALC:
28
28
  github: 'acidanthera/AppleALC'
@@ -30,19 +30,24 @@ module Hackmac
30
30
  github: 'acidanthera/IntelMausi'
31
31
  Lilu:
32
32
  github: 'acidanthera/Lilu'
33
- USBInjectAll:
34
- github: 'Sniki/OS-X-USB-Inject-All'
33
+ #USBInjectAll:
34
+ # github: 'Sniki/OS-X-USB-Inject-All'
35
35
  VirtualSMC:
36
36
  github: 'acidanthera/VirtualSMC'
37
+ debug: false
37
38
  plugins:
38
39
  - SMCProcessor
39
40
  - SMCSuperIO
41
+ BrcmPatchRAM2:
42
+ github: 'acidanthera/BrcmPatchRAM'
43
+ plugins:
44
+ - BrcmFirmwareData
40
45
  WhateverGreen:
41
46
  github: 'acidanthera/WhateverGreen'
42
47
  end
43
48
 
44
49
  def self.load
45
- path = File.expand_path('~/config')
50
+ path = File.expand_path('~/.config/hackmac')
46
51
  mkdir_p path
47
52
  ComplexConfig::Provider.config_dir = path
48
53
  config_path = File.join(path, 'hackmac.yml')
data/lib/hackmac/kext.rb CHANGED
@@ -40,11 +40,20 @@ module Hackmac
40
40
  def remote_kext
41
41
  return @remote_kext if @remote_kext
42
42
  if @config
43
- if source = @config.kext.sources[name] and github = source&.github
43
+ source = @config.kext.sources[name] or return
44
+ case
45
+ when github = source&.github?
44
46
  auth = [ @config.github.user, @config.github.access_token ].compact
45
47
  auth.empty? and auth = nil
46
- suffix = source.debug? ? 'DEBUG' : 'RELEASE'
48
+ suffix =
49
+ case debug = source.debug?
50
+ when true then 'DEBUG'
51
+ when false then 'RELEASE'
52
+ when nil then nil
53
+ end
47
54
  @remote_kext = Hackmac::KextSource.new(github, auth: auth, suffix: suffix)
55
+ when download = source&.download
56
+ @remote_kext = Hackmac::KextDownload.new(download.name, download.version, download.url)
48
57
  end
49
58
  end
50
59
  end
@@ -0,0 +1,39 @@
1
+ require 'open-uri'
2
+ require 'tins/string_version'
3
+
4
+ module Hackmac
5
+ class KextDownload
6
+ include Tins::StringVersion
7
+
8
+ def initialize(name, version, url)
9
+ @name = name
10
+ @url = url
11
+ @version = Version.new(version)
12
+ end
13
+
14
+ attr_reader :name
15
+
16
+ attr_reader :version
17
+
18
+ def download_asset
19
+ data = URI.open(
20
+ @url,
21
+ 'Accept' => 'application/octet-stream',
22
+ &:read
23
+ )
24
+ return File.basename(@url), data
25
+ end
26
+
27
+ def inspect
28
+ "#<#{self.class}: #{to_s}>"
29
+ end
30
+
31
+ def to_s
32
+ "#{name} #{version}"
33
+ end
34
+
35
+ def to_s
36
+ "#{name} #{version}"
37
+ end
38
+ end
39
+ end
@@ -11,7 +11,7 @@ module Hackmac
11
11
  def initialize(github, auth: nil, suffix: nil)
12
12
  @github = github
13
13
  @auth = auth
14
- @suffix = Regexp.quote(suffix || 'RELEASE')
14
+ @suffix = (Regexp.quote(suffix) if suffix)
15
15
  account, repo = github.split(?/)
16
16
  @name = repo
17
17
  releases = URI.open(
@@ -42,12 +42,13 @@ module Hackmac
42
42
 
43
43
  def download_asset
44
44
  @release or return
45
- asset = @release.assets.find { |a| a.name =~ /#@suffix.*\.zip\z/i } or return
45
+ asset = @release.assets.find { |a| a.name =~ /#@suffix.*\.(zip|tar\.gz)\z/i } or return
46
46
  data = URI.open(
47
47
  (GITHUB_API_URL % github) + ("/assets/%s" % asset.id),
48
48
  'Accept' => 'application/octet-stream',
49
- http_basic_authentication: auth
50
- ) { |o| o.read }
49
+ http_basic_authentication: auth,
50
+ &:read
51
+ )
51
52
  return asset.name, data
52
53
  end
53
54
 
@@ -20,6 +20,19 @@ module Hackmac
20
20
  end
21
21
  end
22
22
 
23
+ def decompress(name)
24
+ print "Decompressing #{name.inspect}…"
25
+ case name
26
+ when /\.zip\z/i
27
+ system "unzip #{name.inspect}" or fail "Could not unzip #{name.inspect}"
28
+ when /\.tar\.gz\z/i
29
+ system "tar xfz #{name.inspect}" or fail "Could not tar xfz #{name.inspect}"
30
+ else
31
+ fail "Cannot decompress #{name.inspect}"
32
+ end
33
+ puts "done!"
34
+ end
35
+
23
36
  public
24
37
 
25
38
  def perform
@@ -32,7 +45,7 @@ module Hackmac
32
45
  name, data = kext.remote_kext.download_asset
33
46
  if name
34
47
  File.secure_write(name, data)
35
- system "unzip #{name.inspect}" or fail "Could not unzip #{name.inspect}"
48
+ decompress(name)
36
49
  kext_pathes = []
37
50
  Find.find(dir) do |path|
38
51
  if File.directory?(path)
@@ -1,6 +1,6 @@
1
1
  module Hackmac
2
2
  # Hackmac version
3
- VERSION = '0.6.2'
3
+ VERSION = '0.8.3'
4
4
  VERSION_ARRAY = VERSION.split('.').map(&:to_i) # :nodoc:
5
5
  VERSION_MAJOR = VERSION_ARRAY[0] # :nodoc:
6
6
  VERSION_MINOR = VERSION_ARRAY[1] # :nodoc:
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: hackmac
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.6.2
4
+ version: 0.8.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Florian Frank
8
- autorequire:
8
+ autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-05-15 00:00:00.000000000 Z
11
+ date: 2021-03-05 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: gem_hadar
@@ -149,6 +149,7 @@ extra_rdoc_files:
149
149
  - lib/hackmac/config.rb
150
150
  - lib/hackmac/disks.rb
151
151
  - lib/hackmac/kext.rb
152
+ - lib/hackmac/kext_download.rb
152
153
  - lib/hackmac/kext_source.rb
153
154
  - lib/hackmac/kext_upgrader.rb
154
155
  - lib/hackmac/plist.rb
@@ -168,6 +169,7 @@ files:
168
169
  - lib/hackmac/config.rb
169
170
  - lib/hackmac/disks.rb
170
171
  - lib/hackmac/kext.rb
172
+ - lib/hackmac/kext_download.rb
171
173
  - lib/hackmac/kext_source.rb
172
174
  - lib/hackmac/kext_upgrader.rb
173
175
  - lib/hackmac/plist.rb
@@ -176,7 +178,7 @@ files:
176
178
  homepage: http://github.com/flori/hackmac
177
179
  licenses: []
178
180
  metadata: {}
179
- post_install_message:
181
+ post_install_message:
180
182
  rdoc_options:
181
183
  - "--title"
182
184
  - Hackmac - Some useful tools for working with a Hackintosh
@@ -195,8 +197,8 @@ required_rubygems_version: !ruby/object:Gem::Requirement
195
197
  - !ruby/object:Gem::Version
196
198
  version: '0'
197
199
  requirements: []
198
- rubygems_version: 3.1.2
199
- signing_key:
200
+ rubygems_version: 3.1.4
201
+ signing_key:
200
202
  specification_version: 4
201
203
  summary: Some useful tools for working with a Hackintosh
202
204
  test_files: []