-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #43 from juliandunn/windows-8-and-2012-fixes
Windows 8 and 2012 fixes
- Loading branch information
Showing
8 changed files
with
46 additions
and
342 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,48 @@ | ||
timeout 10 | ||
REM sleeping to give outbound networking a chance to come up | ||
cmd /C cscript %TEMP%\wget.vbs /url:http://www.opscode.com/chef/install.msi /path:chef-client.msi | ||
cmd /C msiexec /qn /i chef-client.msi | ||
|
||
@REM Loop ten times to make sure outbound networking is up | ||
FOR /L %%n IN (1,1,10) DO ( | ||
PING -n 1 www.opscode.com | ||
IF %ERRORLEVEL% == 0 CALL :wget | ||
TIMEOUT 10 | ||
) | ||
|
||
:err | ||
ECHO "Couldn't reach Opscode even after 10 retries" | ||
GOTO :done | ||
|
||
:wget | ||
@rem Install Chef using chef-client MSI installer | ||
@setlocal | ||
|
||
@set REMOTE_SOURCE_MSI_URL=https://www.opscode.com/chef/install.msi | ||
@set LOCAL_DESTINATION_MSI_PATH=%TEMP%\chef-client-latest.msi | ||
@set FALLBACK_QUERY_STRING=?DownloadContext=PowerShell | ||
|
||
@set ALTERNATE_DOWNLOAD_COMMAND=$webClient=new-object System.Net.WebClient; $webClient.DownloadFile('%REMOTE_SOURCE_MSI_URL%%FALLBACK_QUERY_STRING%', '%LOCAL_DESTINATION_MSI_PATH%') | ||
|
||
cscript /nologo %TEMP%\wget.vbs /url:%REMOTE_SOURCE_MSI_URL% /path:"%LOCAL_DESTINATION_MSI_PATH%" | ||
|
||
@rem Work around issues found in Windows Server 2012 around job objects not respecting WSMAN memory quotas | ||
@rem that cause the MSI download process to exceed the quota even when it is increased by administrators. | ||
@rem Retry the download using a more memory-efficient mechanism that only works if PowerShell is available. | ||
@if ERRORLEVEL 1 ( | ||
echo Warning: Failed to download %REMOTE_SOURCE_MSI_URL% to %LOCAL_DESTINATION_MSI_PATH% | ||
echo Warning: Retrying download with PowerShell if available | ||
if EXIST "%LOCAL_DESTINATION_MSI_PATH%" del /f /q "%LOCAL_DESTINATION_MSI_PATH%" | ||
echo powershell -noprofile -noninteractive -command "%ALTERNATE_DOWNLOAD_COMMAND%" | ||
powershell -noprofile -noninteractive -command "%ALTERNATE_DOWNLOAD_COMMAND%" | ||
if NOT ERRORLEVEL 1 ( | ||
echo Download succeeded | ||
) else ( | ||
echo Failed to download %REMOTE_SOURCE_MSI_URL% | ||
echo Subsequent attempt to install the downloaded MSI is likely to fail | ||
) | ||
) | ||
|
||
msiexec /qb /i "%LOCAL_DESTINATION_MSI_PATH%" | ||
|
||
@endlocal | ||
EXIT | ||
|
||
:done | ||
EXIT |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.