diff options
Diffstat (limited to 'subr.pkg/pkg_fetch_download.subr')
-rw-r--r-- | subr.pkg/pkg_fetch_download.subr | 43 |
1 files changed, 43 insertions, 0 deletions
diff --git a/subr.pkg/pkg_fetch_download.subr b/subr.pkg/pkg_fetch_download.subr new file mode 100644 index 00000000..fe7fff85 --- /dev/null +++ b/subr.pkg/pkg_fetch_download.subr @@ -0,0 +1,43 @@ +# +# set +o errexit -o noglob -o nounset is assumed. +# + +pkg_fetch_download() { + local _pfd_group_name="${1}" _pfd_pkg_name="${2}" _pfd_restart_at="${3}"; + + if [ "${ARG_FETCH_FORCE:-}" != "offline" ]; then + if [ "${PKG_URL:+1}" = 1 ]; then + if ! rtl_fetch_dlcache_subdir \ + "${BUILD_DLCACHEDIR}" "${PKG_NAME}" \ + "${PKG_INHERIT_FROM:-}"; + then + return 1; + elif ! rtl_fetch_url_wget \ + "${PKG_URL}" "${PKG_SHA256SUM}" "${BUILD_DLCACHEDIR}/${PKG_NAME}"\ + "${PKG_FNAME}" "${PKG_NAME}" "${PKG_MIRRORS:-}"; then + return 1; + fi; + fi; + + if [ "${PKG_URLS_GIT:+1}" = 1 ]; then + if ! rtl_fetch_dlcache_subdir \ + "${BUILD_DLCACHEDIR}" "${PKG_NAME}" \ + "${PKG_INHERIT_FROM:-}"; + then + return 1; + elif ! rtl_fetch_urls_git \ + "${BUILD_DLCACHEDIR}/${PKG_NAME}" "${DEFAULT_GIT_ARGS}" "${PKG_BASE_DIR}"\ + "${PKG_NAME}" "${PKG_MIRRORS_GIT:-}" ${PKG_URLS_GIT}; then + return 1; + fi; + fi; + + rtl_fetch_clean_dlcache \ + "${BUILD_DLCACHEDIR}" "${PKG_NAME}" \ + "${PKG_FNAME:-}" "${PKG_URLS_GIT:-}"; + fi; + + return 0; +}; + +# vim:filetype=sh |