mirror of
https://github.com/dockur/windows.git
synced 2026-08-05 05:27:23 +01:00
fix: Propagate command substitution failures (#2039)
This commit is contained in:
+8
-4
@@ -1022,15 +1022,19 @@ downloadFile() {
|
||||
local web_desc="$5"
|
||||
local connections="${6:-1}"
|
||||
|
||||
local domain dots
|
||||
local domain parent
|
||||
local msg="Downloading $web_desc"
|
||||
local console_msg="Downloading $desc"
|
||||
|
||||
# Keep mirror messages concise by reducing subdomains to the final two
|
||||
# labels, while Microsoft downloads retain the generic description.
|
||||
domain=$(echo "$url" | awk -F/ '{print $3}')
|
||||
dots=$(echo "$domain" | tr -cd '.' | wc -c)
|
||||
(( dots > 1 )) && domain=$(expr "$domain" : '.*\.\(.*\..*\)')
|
||||
domain="${url#*://}"
|
||||
domain="${domain%%/*}"
|
||||
|
||||
if [[ "$domain" == *.*.* ]]; then
|
||||
parent="${domain#*.}"
|
||||
[ -n "$parent" ] && domain="$parent"
|
||||
fi
|
||||
|
||||
if [ -n "$domain" ] && [[ "${domain,,}" != *"microsoft.com" ]]; then
|
||||
console_msg="Downloading $desc from $domain"
|
||||
|
||||
Reference in New Issue
Block a user