Class: Hackmac::OCValidator
- Inherits:
-
Object
- Object
- Hackmac::OCValidator
- Defined in:
- lib/hackmac/oc_validator.rb
Overview
A class that handles validation of OpenCore bootloader configurations
The OCValidator class provides functionality for verifying the correctness and compatibility of OpenCore EFI configuration files. It retrieves the latest OpenCore release, downloads the necessary validation utilities, and executes validation checks against a specified configuration plist file to ensure it meets the required standards for OpenCore bootloaders.
Instance Method Summary collapse
-
#initialize(mdev:, config:) ⇒ OCValidator
constructor
The initialize method sets up an OCValidator instance by configuring the path to the OpenCore configuration plist file.
-
#perform ⇒ Boolean
The perform method executes the OpenCore configuration validation process.
Constructor Details
#initialize(mdev:, config:) ⇒ OCValidator
The initialize method sets up an OCValidator instance by configuring the path to the OpenCore configuration plist file
This method takes a mount device identifier and configuration object, then constructs the full path to the OpenCore configuration plist file by joining the mount path with the EFI path and OC subdirectory specified in the configuration
25 26 27 28 29 30 |
# File 'lib/hackmac/oc_validator.rb', line 25 def initialize(mdev:, config:) @config = config mount_path = Pathname.new('/Volumes').join(mdev) @config_plist = Pathname.new(mount_path).join(@config.oc.efi_path).join('OC/config.plist') end |
Instance Method Details
#perform ⇒ Boolean
The perform method executes the OpenCore configuration validation process
This method handles the complete workflow for validating an OpenCore configuration file by retrieving the latest OpenCore release, downloading the validation utilities, and running the ocvalidate tool against the specified configuration plist file
42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 |
# File 'lib/hackmac/oc_validator.rb', line 42 def perform isolate do |dir| oc = OC.new(config: @config) name, data = oc.remote.download_asset if name File.secure_write(name, data) decompress(name) result = %x(Utilities/ocvalidate/ocvalidate #{@config_plist.to_s.inspect} 2>&1) if $?.success? STDERR.puts result true else STDERR.puts "Validation has failed!", "", result false end true else fail "#{oc} could not be downloaded" end end end |