Improved download.ps1

This commit is contained in:
Markus Fleschutz 2021-03-29 12:20:57 +02:00
parent 6fdc479d96
commit 8313e34cc1

View File

@ -8,21 +8,14 @@
param($URL = "") param($URL = "")
if ($URL -eq "" ) {
$URL = read-host "Enter URL to download"
}
try { try {
& wget --version & wget --version
} catch { if ($lastExitCode -ne "0") { throw "Can't execute 'wget' - make sure wget is installed and available" }
write-error "Can't execute 'wget' - make sure wget is installed and available"
exit 1
}
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 exit 0
} catch { } catch {
write-error "ERROR: line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])" write-error "ERROR: line $($_.InvocationInfo.ScriptLineNumber): $($Error[0])"