diff options
author | Tim Smith <tsmith@chef.io> | 2018-10-28 13:42:17 -0700 |
---|---|---|
committer | Tim Smith <tsmith@chef.io> | 2018-10-31 12:37:16 -0700 |
commit | c1c83654dd0632898f4774328fac32c920d5e0cf (patch) | |
tree | bd1369ab823aa33e2d66910043968801055bf340 /lib/chef/resource/dmg_package.rb | |
parent | c7c48e3776b9ffed29de5555c2438c9a2a001c29 (diff) | |
download | chef-c1c83654dd0632898f4774328fac32c920d5e0cf.tar.gz |
Don't rely on shelling out to grep to determine if EULA is necessary
Do this natively in Ruby.
Signed-off-by: Tim Smith <tsmith@chef.io>
Diffstat (limited to 'lib/chef/resource/dmg_package.rb')
-rw-r--r-- | lib/chef/resource/dmg_package.rb | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/lib/chef/resource/dmg_package.rb b/lib/chef/resource/dmg_package.rb index fabfbce1a8..056b58b812 100644 --- a/lib/chef/resource/dmg_package.rb +++ b/lib/chef/resource/dmg_package.rb @@ -105,9 +105,9 @@ class Chef passphrase_cmd = new_resource.dmg_passphrase ? "-passphrase #{new_resource.dmg_passphrase}" : "" ruby_block "attach #{dmg_file}" do block do - cmd = shell_out("hdiutil imageinfo #{passphrase_cmd} '#{dmg_file}' | grep -q 'Software License Agreement: true'") - software_license_agreement = cmd.exitstatus == 0 - raise "Requires EULA Acceptance; add 'accept_eula true' to package resource" if software_license_agreement && !new_resource.accept_eula + # example hdiutil imageinfo output: http://rubular.com/r/0xvOaA6d8B + software_license_agreement = /Software License Agreement: true/.match?(shell_out!("hdiutil imageinfo #{passphrase_cmd} '#{dmg_file}'").stdout) + raise "Requires EULA Acceptance; add 'accept_eula true' to dmg_package resource" if software_license_agreement && !new_resource.accept_eula accept_eula_cmd = new_resource.accept_eula ? "echo Y | PAGER=true" : "" shell_out!("#{accept_eula_cmd} hdiutil attach #{passphrase_cmd} '#{dmg_file}' -mountpoint '/Volumes/#{volumes_dir}' -quiet") end |