labs: protect downloader.js from deletion

In its current location, the download helper for Window batch scripts,
downloader.js, gets deleted when the Windows batch scripts are generated
(due to a call to clean_dir).

This patch moves downloader.js to the tools directory where it remains
safe from clean_dir.

Change-Id: I48f3daf613e8517dfb9256af298e9e43f76289bc
This commit is contained in:
Roger Luethi
2015-04-19 17:20:08 +02:00
parent 36cd7475d8
commit 49231a7bde
3 changed files with 3 additions and 1 deletions

View File

@@ -14,7 +14,7 @@ ECHO.
ECHO Expect this to take several minutes or longer, depending on your ECHO Expect this to take several minutes or longer, depending on your
ECHO Internet connection. ECHO Internet connection.
ECHO. ECHO.
cscript /nologo downloader.js %ISOURL% cscript /nologo %TOOLSDIR%\downloader.js %ISOURL%
RENAME downloaded.bin %INSTALLFILE% RENAME downloaded.bin %INSTALLFILE%
MOVE %INSTALLFILE% %IMGDIR% MOVE %INSTALLFILE% %IMGDIR%
IF EXIST %IMGDIR%\%INSTALLFILE% goto got_install_iso IF EXIST %IMGDIR%\%INSTALLFILE% goto got_install_iso

View File

@@ -8,6 +8,7 @@ SET IMGDIR=%TOPDIR%\%P_IMGDIR%
SET LOGDIR=%TOPDIR%\%P_LOGDIR% SET LOGDIR=%TOPDIR%\%P_LOGDIR%
SET STATUSDIR=%TOPDIR%\%P_STATUSDIR% SET STATUSDIR=%TOPDIR%\%P_STATUSDIR%
SET SHAREDIR=%TOPDIR% SET SHAREDIR=%TOPDIR%
SET TOOLSDIR=%TOPDIR%\tools
ECHO %time% Creating directories (if needed) ECHO %time% Creating directories (if needed)
IF NOT EXIST %AUTODIR% mkdir %AUTODIR% IF NOT EXIST %AUTODIR% mkdir %AUTODIR%

View File

@@ -1,5 +1,6 @@
/* Taken from http://superuser.com/a/536400 */ /* Taken from http://superuser.com/a/536400 */
/* Use: cscript /nologo downloader.js <URL> */ /* Use: cscript /nologo downloader.js <URL> */
/* Used by Windows batch scripts to download distro ISO image */
var WinHttpReq = new ActiveXObject("WinHttp.WinHttpRequest.5.1"); var WinHttpReq = new ActiveXObject("WinHttp.WinHttpRequest.5.1");
WinHttpReq.Open("GET", WScript.Arguments(0), /*async=*/false); WinHttpReq.Open("GET", WScript.Arguments(0), /*async=*/false);