How Can I Install A Non-MSI Self Installer on Windows?

Sean Horn -

Versions
--------

ChefDK 0.6.2 (chef-client 12.3.0)
Windows 2012 R2
windows cookbook v1.38.0
chef_handler v1.2.0

Process
-------

The :custom installer_type works on windows 2012 R2 with chefDK 0.6.2(chef-client 12.3.0) and the latest versions of the windows and chef_handler cookbooks.

You can store the test-package-cookbook, chef_handler, and windows cookbooks in a c:\cookbooks directory, then do the chef-client run from c:\ as the Administrator.

You will need to include the windows recipe in the test-package-cookbook's default.rb recipe, before the windows_package resource, like

include_recipe "windows"

windows_package 'Mozilla Firefox 5.0 (x86 en-US)' do
  source 'http://archive.mozilla.org/pub/mozilla.org/mozilla.org/firefox/releases/5.0/win32/en-US/Firefox%20Setup%205.0.exe'
  options '-ms'
  installer_type :custom
  action :install
end

Then, in the metadata.rb of the test-package-cookbook, you need to depend on the windows cookbook like this

depends "windows"

The run will look like this, where the -r option defines the run_list and chef-client in local mode automatically looks for a cookbooks directory in the current directory.

C:\>chef-client -z -r test-package-cookbook
[2015-07-28T20:01:20+00:00] WARN: No config file found or specified on command l ine, using command line options. Starting Chef Client, version 12.3.0 resolving cookbooks for run list: ["test-package-cookbook"] Synchronizing Cookbooks: - test-package-cookbook - windows - chef_handler Compiling Cookbooks... [2015-07-28T20:01:33+00:00] WARN: chef_gem[win32-api] chef_gem compile_time inst allation is deprecated [2015-07-28T20:01:33+00:00] WARN: chef_gem[win32-api] Please set `compile_time f alse` on the resource to use the new behavior. [2015-07-28T20:01:33+00:00] WARN: chef_gem[win32-api] or set `compile_time true` on the resource if compile_time behavior is required. Recipe: windows::default * chef_gem[win32-api] action installWARN: Unresolved specs during Gem::Specifi cation.reset: nokogiri (>= 1.4.0, ~> 1.5) WARN: Clearing out unresolved specs. Please report a bug if this causes problems. (up to date) [2015-07-28T20:01:35+00:00] WARN: chef_gem[win32-service] chef_gem compile_time installation is deprecated [2015-07-28T20:01:35+00:00] WARN: chef_gem[win32-service] Please set `compile_ti me false` on the resource to use the new behavior. [2015-07-28T20:01:35+00:00] WARN: chef_gem[win32-service] or set `compile_time t rue` on the resource if compile_time behavior is required. * chef_gem[win32-service] action install (up to date) [2015-07-28T20:01:35+00:00] WARN: chef_gem[windows-api] chef_gem compile_time in stallation is deprecated [2015-07-28T20:01:35+00:00] WARN: chef_gem[windows-api] Please set `compile_time false` on the resource to use the new behavior. [2015-07-28T20:01:35+00:00] WARN: chef_gem[windows-api] or set `compile_time tru e` on the resource if compile_time behavior is required. * chef_gem[windows-api] action install (up to date) [2015-07-28T20:01:36+00:00] WARN: chef_gem[windows-pr] chef_gem compile_time ins tallation is deprecated [2015-07-28T20:01:36+00:00] WARN: chef_gem[windows-pr] Please set `compile_time false` on the resource to use the new behavior. [2015-07-28T20:01:36+00:00] WARN: chef_gem[windows-pr] or set `compile_time true ` on the resource if compile_time behavior is required. * chef_gem[windows-pr] action install (up to date) [2015-07-28T20:01:36+00:00] WARN: chef_gem[win32-dir] chef_gem compile_time inst allation is deprecated [2015-07-28T20:01:36+00:00] WARN: chef_gem[win32-dir] Please set `compile_time f alse` on the resource to use the new behavior. [2015-07-28T20:01:36+00:00] WARN: chef_gem[win32-dir] or set `compile_time true` on the resource if compile_time behavior is required. * chef_gem[win32-dir] action install (up to date) [2015-07-28T20:01:36+00:00] WARN: chef_gem[win32-event] chef_gem compile_time in stallation is deprecated [2015-07-28T20:01:36+00:00] WARN: chef_gem[win32-event] Please set `compile_time false` on the resource to use the new behavior. [2015-07-28T20:01:36+00:00] WARN: chef_gem[win32-event] or set `compile_time tru e` on the resource if compile_time behavior is required. * chef_gem[win32-event] action install (up to date) [2015-07-28T20:01:36+00:00] WARN: chef_gem[win32-mutex] chef_gem compile_time in stallation is deprecated [2015-07-28T20:01:36+00:00] WARN: chef_gem[win32-mutex] Please set `compile_time false` on the resource to use the new behavior. [2015-07-28T20:01:36+00:00] WARN: chef_gem[win32-mutex] or set `compile_time tru e` on the resource if compile_time behavior is required. * chef_gem[win32-mutex] action install (up to date) Converging 8 resources * chef_gem[win32-api] action install (up to date) * chef_gem[win32-service] action install (up to date) * chef_gem[windows-api] action install (up to date) * chef_gem[windows-pr] action install (up to date) * chef_gem[win32-dir] action install (up to date) * chef_gem[win32-event] action install (up to date) * chef_gem[win32-mutex] action install (up to date) Recipe: test-package-cookbook::default * windows_package[Mozilla Firefox 5.0 (x86 en-US)] action install Recipe: <Dynamically Defined Resource> * remote_file[C:/Users/Administrator\.chef\local-mode-cache\cache/Firefox Se tup 5.0.exe] action create - create new file C:/Users/Administrator\.chef\local-mode-cache\cache/Fire fox Setup 5.0.exe - update content in file C:/Users/Administrator\.chef\local-mode-cache\cac he/Firefox Setup 5.0.exe from none to d3b3c9 (file sizes exceed 10000000 bytes, diff output suppressed) Running handlers: Running handlers complete Chef Client finished, 2/16 resources updated in 23.999123 seconds C:\>

Then, if you look in Programs and Features, you will see the new Firefox program installation is present.

Have more questions? Submit a request

Comments

Powered by Zendesk