aboutsummaryrefslogtreecommitdiff
path: root/NvCloth/scripts/packman/win-bootstrap/fetch_file_from_s3.cmd
diff options
context:
space:
mode:
Diffstat (limited to 'NvCloth/scripts/packman/win-bootstrap/fetch_file_from_s3.cmd')
-rw-r--r--NvCloth/scripts/packman/win-bootstrap/fetch_file_from_s3.cmd22
1 files changed, 22 insertions, 0 deletions
diff --git a/NvCloth/scripts/packman/win-bootstrap/fetch_file_from_s3.cmd b/NvCloth/scripts/packman/win-bootstrap/fetch_file_from_s3.cmd
new file mode 100644
index 0000000..63766c1
--- /dev/null
+++ b/NvCloth/scripts/packman/win-bootstrap/fetch_file_from_s3.cmd
@@ -0,0 +1,22 @@
+:: You need to specify <package-name> <target-path> as input to this command
+@setlocal
+@set PACKAGE_NAME=%1
+@set TARGET_PATH=%2
+
+@echo Fetching %PACKAGE_NAME% from s3 ...
+
+@powershell -ExecutionPolicy ByPass -NoLogo -NoProfile -File "%~dp0fetch_file_from_s3.ps1" -sourceName %PACKAGE_NAME% ^
+ -output %TARGET_PATH%
+:: A bug in powershell prevents the errorlevel code from being set when using the -File execution option
+:: We must therefore do our own failure analysis, basically make sure the file exists and is larger than 0 bytes:
+@if not exist %TARGET_PATH% goto ERROR_DOWNLOAD_FAILED
+@if %~z2==0 goto ERROR_DOWNLOAD_FAILED
+
+@endlocal
+@exit /b 0
+
+:ERROR_DOWNLOAD_FAILED
+@echo Failed to download file from %1
+@echo Most likely because endpoint cannot be reached (VPN connection down?)
+@endlocal
+@exit /b 1 \ No newline at end of file