Merge pull request #3256 from claui/pkg-unshadow-options
Unshadow `allow_untrusted` option for pkg artifact
This commit is contained in:
commit
7ee86cfe77
@ -9,17 +9,19 @@ module Hbc
|
|||||||
class Pkg < AbstractArtifact
|
class Pkg < AbstractArtifact
|
||||||
attr_reader :pkg_relative_path
|
attr_reader :pkg_relative_path
|
||||||
|
|
||||||
def self.from_args(cask, path, **options)
|
def self.from_args(cask, path, **stanza_options)
|
||||||
options.extend(HashValidator).assert_valid_keys(:allow_untrusted, :choices)
|
stanza_options.extend(HashValidator).assert_valid_keys(
|
||||||
new(cask, path, **options)
|
:allow_untrusted, :choices
|
||||||
|
)
|
||||||
|
new(cask, path, **stanza_options)
|
||||||
end
|
end
|
||||||
|
|
||||||
attr_reader :path, :options
|
attr_reader :path, :stanza_options
|
||||||
|
|
||||||
def initialize(cask, path, **options)
|
def initialize(cask, path, **stanza_options)
|
||||||
super(cask)
|
super(cask)
|
||||||
@path = cask.staged_path.join(path)
|
@path = cask.staged_path.join(path)
|
||||||
@options = options
|
@stanza_options = stanza_options
|
||||||
end
|
end
|
||||||
|
|
||||||
def summarize
|
def summarize
|
||||||
@ -32,7 +34,7 @@ module Hbc
|
|||||||
|
|
||||||
private
|
private
|
||||||
|
|
||||||
def run_installer(command: nil, verbose: false, **options)
|
def run_installer(command: nil, verbose: false, **_options)
|
||||||
ohai "Running installer for #{cask}; your password may be necessary."
|
ohai "Running installer for #{cask}; your password may be necessary."
|
||||||
ohai "Package installers may write to any location; options such as --appdir are ignored."
|
ohai "Package installers may write to any location; options such as --appdir are ignored."
|
||||||
unless path.exist?
|
unless path.exist?
|
||||||
@ -43,7 +45,9 @@ module Hbc
|
|||||||
"-target", "/"
|
"-target", "/"
|
||||||
]
|
]
|
||||||
args << "-verboseR" if verbose
|
args << "-verboseR" if verbose
|
||||||
args << "-allowUntrusted" if options.fetch(:allow_untrusted, false)
|
if stanza_options.fetch(:allow_untrusted, false)
|
||||||
|
args << "-allowUntrusted"
|
||||||
|
end
|
||||||
with_choices_file do |choices_path|
|
with_choices_file do |choices_path|
|
||||||
args << "-applyChoiceChangesXML" << choices_path if choices_path
|
args << "-applyChoiceChangesXML" << choices_path if choices_path
|
||||||
command.run!("/usr/sbin/installer", sudo: true, args: args, print_stdout: true)
|
command.run!("/usr/sbin/installer", sudo: true, args: args, print_stdout: true)
|
||||||
@ -51,7 +55,7 @@ module Hbc
|
|||||||
end
|
end
|
||||||
|
|
||||||
def with_choices_file
|
def with_choices_file
|
||||||
choices = options.fetch(:choices, {})
|
choices = stanza_options.fetch(:choices, {})
|
||||||
return yield nil if choices.empty?
|
return yield nil if choices.empty?
|
||||||
|
|
||||||
Tempfile.open(["choices", ".xml"]) do |file|
|
Tempfile.open(["choices", ".xml"]) do |file|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user