diff options
author | Tim Smith <tsmith@chef.io> | 2018-10-28 13:42:17 -0700 |
---|---|---|
committer | Tim Smith <tsmith@chef.io> | 2018-10-28 13:42:17 -0700 |
commit | 4663521024484c05b19a0e62a5dcc3a6ed0a353c (patch) | |
tree | 08a8e4524fc66250b5ba0fb1195c0ee2d3e199fd /lib/chef/resource/dmg_package.rb | |
parent | 8f8517eabf7cfeb7f59c4081fda191352ff2047d (diff) | |
download | chef-4663521024484c05b19a0e62a5dcc3a6ed0a353c.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 |