@echo off rem Author:: Kyle Allan () rem Original Author: rem rem Author:: Seth Chisamore () rem Copyright:: Copyright (c) 2011 Opscode, Inc. rem License:: Apache License, Version 2.0 rem rem Licensed under the Apache License, Version 2.0 (the "License"); rem you may not use this file except in compliance with the License. rem You may obtain a copy of the License at rem rem http://www.apache.org/licenses/LICENSE-2.0 rem rem Unless required by applicable law or agreed to in writing, software rem distributed under the License is distributed on an "AS IS" BASIS, rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. rem See the License for the specific language governing permissions and rem limitations under the License. rem setlocal <%= "SETX HTTP_PROXY \"#{bootstrap_proxy}\"" if bootstrap_proxy %> mkdir <%= bootstrap_directory %> > <%= bootstrap_directory %>\wget.ps1 ( <%= windows_wget_powershell %> ) rem Determine the version and the architecture FOR /F "tokens=1-8 delims=.[] " %%A IN ('ver') DO ( set WinMajor=%%D set WinMinor=%%E set WinBuild=%%F ) goto Version%WinMajor%.%WinMinor% rem If this is an unknown version of windows set the default set MACHINE_OS=2008r2 goto architecture :Version6.0 set MACHINE_OS=2008 goto architecture :Version5.2 set MACHINE_OS=2003r2 goto architecture :Version6.1 set MACHINE_OS=2008r2 goto architecture :Version6.2 set MACHINE_OS=2012 goto architecture :architecture goto Architecture%PROCESSOR_ARCHITECTURE% rem If this is an unknown architecture set the default set MACHINE_ARCH=i686 goto install :Architecturex86 set MACHINE_ARCH=i686 goto install :Architectureamd64 set MACHINE_ARCH=x86_64 goto install :install rem Install Chef using chef-client MSI installer set "VERSION_STRING=<%= chef_version %>" set "REMOTE_SOURCE_MSI_URL=https://www.opscode.com/chef/download?p=windows&pv=%MACHINE_OS%&m=%MACHINE_ARCH%&v=%VERSION_STRING%" set "LOCAL_DESTINATION_MSI_PATH=<%= local_download_path %>" set "FALLBACK_QUERY_STRING=&DownloadContext=PowerShell" powershell -ExecutionPolicy Unrestricted -NoProfile -NonInteractive "& '<%= bootstrap_directory %>\wget.ps1' '%REMOTE_SOURCE_MSI_URL%%FALLBACK_QUERY_STRING%' '%LOCAL_DESTINATION_MSI_PATH%'" <%= install_chef %> endlocal > <%= bootstrap_directory %>\validation.pem ( <%= validation_key %> ) <% if encrypted_data_bag_secret -%> > <%= bootstrap_directory %>\encrypted_data_bag_secret ( <%= encrypted_data_bag_secret %> ) <% end -%> > <%= bootstrap_directory %>\client.rb ( <%= chef_config %> ) > <%= bootstrap_directory %>\first-boot.json ( <%= first_boot %> ) SET "PATH=%PATH%;<%= env_path %>" SETX PATH "%PATH;<%= env_path %>" <%= chef_run %>