From 8313e34cc1bb35c5b1d8a7b9c544c421c965cbac Mon Sep 17 00:00:00 2001 From: Markus Fleschutz Date: Mon, 29 Mar 2021 12:20:57 +0200 Subject: [PATCH] Improved download.ps1 --- Scripts/download.ps1 | 15 ++++----------- 1 file changed, 4 insertions(+), 11 deletions(-) diff --git a/Scripts/download.ps1 b/Scripts/download.ps1 index 0a649044..8bc66ac6 100755 --- a/Scripts/download.ps1 +++ b/Scripts/download.ps1 @@ -8,21 +8,14 @@ param($URL = "") -if ($URL -eq "" ) { - $URL = read-host "Enter URL to download" -} - try { & wget --version -} catch { - write-error "Can't execute 'wget' - make sure wget is installed and available" - exit 1 -} + if ($lastExitCode -ne "0") { throw "Can't execute 'wget' - make sure wget is installed and available" } -try { - wget --mirror --convert-links --adjust-extension --page-requisites --no-parent $URL --directory-prefix . --no-verbose + & wget --mirror --convert-links --adjust-extension --page-requisites --no-parent $URL --directory-prefix . --no-verbose + if ($lastExitCode -ne "0") { throw "Can't execute 'wget --mirror $URL'" } - write-host -foregroundColor green "Done." + write-host -foregroundColor green "OK - downloaded from $URL" exit 0 } catch { write-error "ERROR: line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"