Permalink
Browse files

added accept_eula as an option when installing dmgs

  • Loading branch information...
1 parent 510d7fa commit 9bece7b8d0b5878779c1646be7a3ae66f6662c1c Brian Cunnie & Matthew Kocher committed Sep 30, 2011
Showing with 5 additions and 2 deletions.
  1. +3 −2 providers/package.rb
  2. +2 −0 resources/package.rb
View
@@ -56,8 +56,9 @@ def load_current_resource
ruby_block "attach #{dmg_file}" do
block do
software_license_agreement = system("hdiutil imageinfo #{passphrase_cmd} #{dmg_file} | grep -q 'Software License Agreement: true'")
- confirm_mount_cmd = software_license_agreement ? "echo Y |" : ""
- system "#{confirm_mount_cmd} hdiutil attach #{passphrase_cmd} '#{dmg_file}'"
+ raise "Requires EULA Acceptance; add 'accept_eula true' to package resource" if software_license_agreement && ! new_resource.accept_eula
+ accept_eula_cmd = new_resource.accept_eula ? "echo Y |" : ""
+ system "#{accept_eula_cmd} hdiutil attach #{passphrase_cmd} '#{dmg_file}'"
end
not_if "hdiutil info #{passphrase_cmd} | grep -q 'image-path.*#{dmg_file}'"
end
View
@@ -28,6 +28,8 @@
attribute :package_id, :kind_of => String, :default => nil
attribute :dmg_passphrase, :kind_of => String, :default => nil
attribute :installed, :kind_of => [TrueClass, FalseClass], :default => false
+attribute :accept_eula, :kind_of => [TrueClass, FalseClass], :default => false
+
def initialize(name, run_context=nil)
super

0 comments on commit 9bece7b

Please sign in to comment.