class Hackmac::OCValidator
# Configures validation for an OpenCore installation on a specific disk
validator = Hackmac::OCValidator.new(mdev: ‘/dev/disk1’, config: config_obj)
@example
ensure it meets the required standards for OpenCore bootloaders.
executes validation checks against a specified configuration plist file to
latest OpenCore release, downloads the necessary validation utilities, and
and compatibility of OpenCore EFI configuration files. It retrieves the
The OCValidator class provides functionality for verifying the correctness
A class that handles validation of OpenCore bootloader configurations
def initialize(mdev:, config:)
-
config(Object) -- the configuration object containing OpenCore settings including the EFI path -
mdev(String) -- the mount device identifier for the EFI partition
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
def perform
-
(RuntimeError)- raised when the OpenCore download fails or when no
Returns:
-
(Boolean)- returns true if validation succeeds, false if validation fails
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