Commit c290483c authored by Vitaly Lipatov's avatar Vitaly Lipatov

epm-epm_install: support mirrors

parent acbd89e9
......@@ -20,6 +20,36 @@
load_helper epm-install
# copied from play.d/common.sh
check_url_is_accessible()
{
local res
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
check_url_is_accessible "$MIRROR" && URL="$MIRROR"
return
fi
MIRROR="https://mirror.eterfund.ru"
SECONDURL="$(echo "$URL" | sed -e "s|^.*://|$MIRROR/|")"
check_url_is_accessible "$SECONDURL" && URL="$SECONDURL" && return
MIRROR="https://mirror.eterfund.org"
SECONDURL="$(echo "$URL" | sed -e "s|^.*://|$MIRROR/|")"
check_url_is_accessible "$SECONDURL" && URL="$SECONDURL" && return
}
__epm_korinf_site_mask() {
local MASK="$1"
local archprefix=""
......@@ -27,7 +57,9 @@ __epm_korinf_site_mask() {
rhas "$MASK" "[-_]" || MASK="$MASK[-_][0-9]"
# set arch for Korinf compatibility
[ "$($DISTRVENDOR -a)" = "x86_64" ] && archprefix="x86_64/"
echo "http://updates.etersoft.ru/pub/Korinf/$archprefix$($DISTRVENDOR -e)/$MASK*.$($DISTRVENDOR -p)"
URL="http://updates.etersoft.ru/pub/Korinf"
update_url_if_need_mirrored
echo "$URL/$archprefix$($DISTRVENDOR -e)/$MASK*.$($DISTRVENDOR -p)"
}
__epm_korinf_list() {
......
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