Class: UnpackStrategy::Dmg::Mount Private
Overview
This class is part of a private API. This class may only be used in the Homebrew/brew repository. Third parties should avoid using this class if possible, as it may be removed or changed without warning.
Strategy for unpacking a volume mounted from a disk image.
Constant Summary
Constants included from UnpackStrategy
Instance Attribute Summary
Attributes included from UnpackStrategy
#merge_xattrs, #path, #temporary_directory
Class Method Summary collapse
- .can_extract?(_path) ⇒ Boolean private
- .extensions ⇒ Array<String> private
Instance Method Summary collapse
- #eject(verbose: false) ⇒ void private
Methods included from ClassMethods
Methods included from UnpackStrategy
#dependencies, detect, #each_directory, #extract, #extract_nestedly, from_extension, from_magic, from_name, from_type, #initialize
Methods included from Utils::Output::Mixin
#issue_reporting_message, #odebug, #odeprecated, #odie, #odisabled, #ofail, #oh1, #oh1_title, #ohai, #ohai_title, #onoe, #opoo, #opoo_outside_github_actions, #opoo_without_github_actions_annotation, #pretty_cannot_install, #pretty_deprecated, #pretty_disabled, #pretty_duration, #pretty_install_status, #pretty_installed, #pretty_uninstalled, #pretty_unmarked, #pretty_upgradable, #pretty_warning
Methods included from SystemCommand::Mixin
#command_sandbox, #system_command, #system_command!
Class Method Details
.can_extract?(_path) ⇒ Boolean
This method is part of a private API. This method may only be used in the Homebrew/brew repository. Third parties should avoid using this method if possible, as it may be removed or changed without warning.
135 |
# File 'unpack_strategy/dmg.rb', line 135 def self.can_extract?(_path) = false |
.extensions ⇒ Array<String>
This method is part of a private API. This method may only be used in the Homebrew/brew repository. Third parties should avoid using this method if possible, as it may be removed or changed without warning.
132 |
# File 'unpack_strategy/dmg.rb', line 132 def self.extensions = [] |
Instance Method Details
#eject(verbose: false) ⇒ void
This method is part of a private API. This method may only be used in the Homebrew/brew repository. Third parties should avoid using this method if possible, as it may be removed or changed without warning.
This method returns an undefined value.
91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 |
# File 'unpack_strategy/dmg.rb', line 91 def eject(verbose: false) tries = 3 begin return unless path.exist? if tries > 1 disk_info = system_command!( "diskutil", args: ["info", "-plist", path], print_stderr: false, verbose:, ) # For HFS, just use <mount-path> # For APFS, find the <physical-store> corresponding to <mount-path> eject_paths = disk_info.plist .fetch("APFSPhysicalStores", []) .filter_map { |store| store["APFSPhysicalStore"] } .presence || [path] eject_paths.each do |eject_path| system_command! "diskutil", args: ["eject", eject_path], print_stderr: false, verbose: end else system_command! "diskutil", args: ["unmount", "force", path], print_stderr: false, verbose: end rescue ErrorDuringExecution => e raise e if (tries -= 1).zero? sleep 1 retry end end |