pkgmeek: try the Pkgfile url before hitting the PKGMK_SOURCE_MIRRORS
This commit is contained in:
parent
817de00615
commit
3aacbacba0
@ -75,7 +75,8 @@ here="${_local_[$u]}"; url="${source[$u]}";
|
|||||||
errDL+=1; }
|
errDL+=1; }
|
||||||
done ; }
|
done ; }
|
||||||
|
|
||||||
[ $errDL = 0 ] && info "Successfully obtained all needed source files." || exit $E_DOWNLOAD
|
[ $errDL = 0 ] && { [ "$PKGMK_MTIME_ONLY" = "yes" ] || \
|
||||||
|
info "Successfully obtained all needed source files."; } || exit $E_DOWNLOAD
|
||||||
|
|
||||||
# If the user only asked for '-utd', perform the check using the sources that do exist.
|
# If the user only asked for '-utd', perform the check using the sources that do exist.
|
||||||
check_pkg_mtime; pkg_utd=$?
|
check_pkg_mtime; pkg_utd=$?
|
||||||
@ -365,7 +366,7 @@ check_pkg_mtime() { # can be called even if some sources are missing
|
|||||||
}
|
}
|
||||||
|
|
||||||
fetch_source() {
|
fetch_source() {
|
||||||
local u="$1"; local h="$2"; local m=0; local REPO SAVE_AS OCONTINUE OOUT; local finished=0;
|
local u="$1"; local h="$2"; local finished=0; local REPO SAVE_AS OCONTINUE OOUT
|
||||||
|
|
||||||
# Determine whether git can be used to obtain sources
|
# Determine whether git can be used to obtain sources
|
||||||
local PKGMK_GIT_COMMAND="/usr/bin/git"
|
local PKGMK_GIT_COMMAND="/usr/bin/git"
|
||||||
@ -377,13 +378,14 @@ fetch_source() {
|
|||||||
[[ "$PKGMK_DOWNLOAD_PROG" =~ curl$ ]] && { OCONTINUE="-C -"; OOUT="$PKGMK_CURL_OPTIONS -o"; }
|
[[ "$PKGMK_DOWNLOAD_PROG" =~ curl$ ]] && { OCONTINUE="-C -"; OOUT="$PKGMK_CURL_OPTIONS -o"; }
|
||||||
[[ "$PKGMK_DOWNLOAD_PROG" =~ (wget|curl)$ ]] || SAVE_AS=/bin/false
|
[[ "$PKGMK_DOWNLOAD_PROG" =~ (wget|curl)$ ]] || SAVE_AS=/bin/false
|
||||||
|
|
||||||
while [ $m -le ${#PKGMK_SOURCE_MIRRORS[@]} ] && [ $finished = 0 ] && [[ ! $SAVE_AS =~ false$ ]]; do
|
local m=${#PKGMK_SOURCE_MIRRORS[@]}
|
||||||
# when the index goes past the last element of PKGMK_SOURCE_MIRRORS,
|
# nonexistent element of PKGMK_SOURCE_MIRRORS means that the
|
||||||
# switch to using the url in the 'source' array.
|
# url given in the Pkgfile will be tried first
|
||||||
|
while [ $m -ge 0 ] && [ $finished = 0 ] && [[ ! $SAVE_AS =~ false$ ]]; do
|
||||||
[ "${PKGMK_SOURCE_MIRRORS[m]}" = "" ] && um=$u || \
|
[ "${PKGMK_SOURCE_MIRRORS[m]}" = "" ] && um=$u || \
|
||||||
{ REPO=$(echo ${PKGMK_SOURCE_MIRRORS[m]} | sed 's,/$,,');
|
{ REPO=$(echo ${PKGMK_SOURCE_MIRRORS[m]} | sed 's,/$,,');
|
||||||
um=$REPO/$(echo $u | sed 's,.*/,,'); }
|
um=$REPO/$(echo $u | sed 's,.*/,,'); }
|
||||||
m=$(( m+1 ))
|
m=$(( m-1 ))
|
||||||
|
|
||||||
# interrupted downloads from a previous run should be put where wget or curl will find them
|
# interrupted downloads from a previous run should be put where wget or curl will find them
|
||||||
[ -s "$src_dir/$h.partial" ] && { ln -s "$src_dir/$h.partial" . ;
|
[ -s "$src_dir/$h.partial" ] && { ln -s "$src_dir/$h.partial" . ;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user