Print DMG EULA when --verbose.
This commit is contained in:
parent
2f0aad5d88
commit
80f827e926
@ -16,7 +16,7 @@ module Hbc
|
|||||||
end
|
end
|
||||||
|
|
||||||
ohai "Extracting nested container #{source.basename}"
|
ohai "Extracting nested container #{source.basename}"
|
||||||
container.new(@cask, source, @command).extract
|
container.new(@cask, source, @command, verbose: verbose?).extract
|
||||||
FileUtils.remove_entry_secure(source)
|
FileUtils.remove_entry_secure(source)
|
||||||
end
|
end
|
||||||
end
|
end
|
||||||
|
|||||||
@ -1,11 +1,16 @@
|
|||||||
module Hbc
|
module Hbc
|
||||||
class Container
|
class Container
|
||||||
class Base
|
class Base
|
||||||
def initialize(cask, path, command, nested: false)
|
def initialize(cask, path, command, nested: false, verbose: false)
|
||||||
@cask = cask
|
@cask = cask
|
||||||
@path = path
|
@path = path
|
||||||
@command = command
|
@command = command
|
||||||
@nested = nested
|
@nested = nested
|
||||||
|
@verbose = verbose
|
||||||
|
end
|
||||||
|
|
||||||
|
def verbose?
|
||||||
|
@verbose
|
||||||
end
|
end
|
||||||
|
|
||||||
def extract_nested_inside(dir)
|
def extract_nested_inside(dir)
|
||||||
@ -32,7 +37,7 @@ module Hbc
|
|||||||
return false unless container
|
return false unless container
|
||||||
|
|
||||||
ohai "Extracting nested container #{source.basename}"
|
ohai "Extracting nested container #{source.basename}"
|
||||||
container.new(@cask, source, @command, nested: true).extract
|
container.new(@cask, source, @command, nested: true, verbose: verbose?).extract
|
||||||
|
|
||||||
true
|
true
|
||||||
end
|
end
|
||||||
|
|||||||
@ -31,11 +31,27 @@ module Hbc
|
|||||||
Dir.mktmpdir do |unpack_dir|
|
Dir.mktmpdir do |unpack_dir|
|
||||||
cdr_path = Pathname.new(unpack_dir).join("#{path.basename(".dmg")}.cdr")
|
cdr_path = Pathname.new(unpack_dir).join("#{path.basename(".dmg")}.cdr")
|
||||||
|
|
||||||
|
without_eula = @command.run("/usr/bin/hdiutil",
|
||||||
|
args: ["attach", "-plist", "-nobrowse", "-readonly", "-noidme", "-mountrandom", unpack_dir, path],
|
||||||
|
input: "qn\n",
|
||||||
|
print_stderr: false)
|
||||||
|
|
||||||
|
# If mounting without agreeing to EULA succeeded, there is none.
|
||||||
|
plist = if without_eula.success?
|
||||||
|
without_eula.plist
|
||||||
|
else
|
||||||
@command.run!("/usr/bin/hdiutil", args: ["convert", "-quiet", "-format", "UDTO", "-o", cdr_path, path])
|
@command.run!("/usr/bin/hdiutil", args: ["convert", "-quiet", "-format", "UDTO", "-o", cdr_path, path])
|
||||||
|
|
||||||
plist = @command.run!("/usr/bin/hdiutil",
|
with_eula = @command.run!("/usr/bin/hdiutil",
|
||||||
args: ["attach", "-plist", "-nobrowse", "-readonly", "-noidme", "-mountrandom", unpack_dir, cdr_path],
|
args: ["attach", "-plist", "-nobrowse", "-readonly", "-noidme", "-mountrandom", unpack_dir, cdr_path])
|
||||||
input: "qy\n").plist
|
|
||||||
|
if verbose? && !(eula_text = without_eula.stdout).empty?
|
||||||
|
ohai "Software License Agreement for '#{path}':"
|
||||||
|
puts eula_text
|
||||||
|
end
|
||||||
|
|
||||||
|
with_eula.plist
|
||||||
|
end
|
||||||
|
|
||||||
yield mounts_from_plist(plist)
|
yield mounts_from_plist(plist)
|
||||||
end
|
end
|
||||||
|
|||||||
@ -165,7 +165,7 @@ module Hbc
|
|||||||
end
|
end
|
||||||
|
|
||||||
odebug "Using container class #{container} for #{@downloaded_path}"
|
odebug "Using container class #{container} for #{@downloaded_path}"
|
||||||
container.new(@cask, @downloaded_path, @command).extract
|
container.new(@cask, @downloaded_path, @command, verbose: verbose?).extract
|
||||||
end
|
end
|
||||||
|
|
||||||
def install_artifacts
|
def install_artifacts
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user