labs: Automatically download install ISO in Windows
With this patch, the Windows batch scripts attempt to automatically download the install ISO image (this is already the case on Linux, OS X). Change-Id: I080b593f2b627801845f18587521ad64d53b3504
This commit is contained in:
parent
4e887b798f
commit
c992ae3e21
@ -4,12 +4,25 @@ DEL /S /Q %LOGDIR%
|
||||
|
||||
ECHO %time% Looking for %IMGDIR%\%INSTALLFILE%
|
||||
IF EXIST %IMGDIR%\%INSTALLFILE% goto got_install_iso
|
||||
|
||||
ECHO.
|
||||
ECHO %INSTALLFILE% not found in %IMGDIR%.
|
||||
ECHO.
|
||||
ECHO To proceed, I need the install ISO from
|
||||
ECHO Trying to download the install ISO from
|
||||
ECHO %ISOURL%
|
||||
ECHO.
|
||||
ECHO Expect this to take several minutes or longer, depending on your
|
||||
ECHO Internet connection.
|
||||
ECHO.
|
||||
cscript /nologo downloader.js %ISOURL%
|
||||
RENAME downloaded.bin %INSTALLFILE%
|
||||
MOVE %INSTALLFILE% %IMGDIR%
|
||||
IF EXIST %IMGDIR%\%INSTALLFILE% goto got_install_iso
|
||||
ECHO.
|
||||
ECHO %INSTALLFILE% still not found in %IMGDIR%.
|
||||
ECHO Aborting.
|
||||
ECHO.
|
||||
|
||||
goto :terminate
|
||||
|
||||
:got_install_iso
|
||||
|
12
labs/wbatch/downloader.js
Normal file
12
labs/wbatch/downloader.js
Normal file
@ -0,0 +1,12 @@
|
||||
/* Taken from http://superuser.com/a/536400 */
|
||||
/* Use: cscript /nologo downloader.js <URL> */
|
||||
|
||||
var WinHttpReq = new ActiveXObject("WinHttp.WinHttpRequest.5.1");
|
||||
WinHttpReq.Open("GET", WScript.Arguments(0), /*async=*/false);
|
||||
WinHttpReq.Send();
|
||||
|
||||
BinStream = new ActiveXObject("ADODB.Stream");
|
||||
BinStream.Type = 1;
|
||||
BinStream.Open();
|
||||
BinStream.Write(WinHttpReq.ResponseBody);
|
||||
BinStream.SaveToFile("downloaded.bin");
|
Loading…
x
Reference in New Issue
Block a user