Permalink
Browse files

dmg : User can set where resources are installed, to check before re-…

…installing
  • Loading branch information...
1 parent a94c895 commit 6610703a194c8264f8a20ab9383e27813ab777df @sax sax committed with jtimberman Nov 28, 2011
Showing with 11 additions and 4 deletions.
  1. +10 −4 dmg/providers/package.rb
  2. +1 −0 dmg/resources/package.rb
@@ -21,7 +21,11 @@ def load_current_resource
@dmgpkg = Chef::Resource::DmgPackage.new(new_resource.name)
@dmgpkg.app(new_resource.app)
Chef::Log.debug("Checking for application #{new_resource.app}")
- installed = ::File.directory?("#{new_resource.destination}/#{new_resource.app}.app")
+ if new_resource.installed_resource
+ installed = ::File.exist?(new_resource.installed_resource)
+ else
+ installed = ::File.directory?("#{new_resource.destination}/#{new_resource.app}.app")
+ end
@dmgpkg.installed(installed)
end
@@ -52,9 +56,11 @@ def load_current_resource
execute "hdiutil detach '/Volumes/#{volumes_dir}'"
- file "#{new_resource.destination}/#{new_resource.app}.app/Contents/MacOS/#{new_resource.app}" do
- mode 0755
- ignore_failure true
+ if ::File.directory?("#{new_resource.destination}/#{new_resource.app}.app")
+ file "#{new_resource.destination}/#{new_resource.app}.app/Contents/MacOS/#{new_resource.app}" do
+ mode 0755
+ ignore_failure true
+ end
end
end
@@ -26,6 +26,7 @@
attribute :dmg_name, :kind_of => String, :default => nil
attribute :type, :kind_of => String, :default => "app"
attribute :installed, :kind_of => [TrueClass, FalseClass], :default => false
+attribute :installed_resource, :kind_of => String, :default => nil
def initialize(name, run_context=nil)
super

0 comments on commit 6610703

Please sign in to comment.