Commit 911f870c authored by Vitaly Lipatov's avatar Vitaly Lipatov

play.d/common.sh: add update_url_if_need_mirrored

parent ef042700
......@@ -90,4 +90,19 @@ check_url_is_accessible()
epm tool eget --check "$1"
}
# update URL variable
update_url_if_need_mirrored()
{
local MIRROR="$1"
local SECONDURL
check_url_is_accessible "$URL" && return
if [ -n "$MIRROR" ] ; then
SECONDURL="$MIRROR"
else
MIRROR="https://mirror.eterfund.org"
SECONDURL="$(echo "$URL" | sed -e "s|^.*://|$MIRROR/|")"
fi
check_url_is_accessible "$SECONDURL" && URL="$SECONDURL"
}
check_supported_arch $SUPPORTEDARCHES || fatal "Only $SUPPORTEDARCHES is supported"
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment