e9fa07
#
8d7a8a
# Copyright (c) 2016, 2017, 2018, 2019, 2020, 2021, 2022, 2023 LucĂ­a Andrea Illanes Albornoz <lucia@luciaillanes.de>
e9fa07
# set +o errexit -o noglob -o nounset is assumed.
e9fa07
#
e9fa07
e9fa07
pkg_fetch_download() {
e9fa07
	local _pfd_group_name="${1}" _pfd_pkg_name="${2}" _pfd_restart_at="${3}";
e9fa07
e9fa07
	if [ "${ARG_FETCH_FORCE:-}" != "offline" ]; then
e9fa07
		if [ "${PKG_URL:+1}" = 1 ]; then
e9fa07
			if ! rtl_fetch_dlcache_subdir				\
e9fa07
					"${BUILD_DLCACHEDIR}" "${PKG_NAME}"	\
e9fa07
					"${PKG_INHERIT_FROM:-}";
e9fa07
			then
e9fa07
				return 1;
e9fa07
			elif ! rtl_fetch_url_wget	\
e9fa07
					"${PKG_URL}" "${PKG_SHA256SUM}" "${BUILD_DLCACHEDIR}/${PKG_NAME}"\
e9fa07
					"${PKG_FNAME}" "${PKG_NAME}" "${PKG_MIRRORS:-}"; then
e9fa07
				return 1;
e9fa07
			fi;
e9fa07
		fi;
e9fa07
e9fa07
		if [ "${PKG_URLS_GIT:+1}" = 1 ]; then
e9fa07
			if ! rtl_fetch_dlcache_subdir				\
e9fa07
					"${BUILD_DLCACHEDIR}" "${PKG_NAME}"	\
e9fa07
					"${PKG_INHERIT_FROM:-}";
e9fa07
			then
e9fa07
				return 1;
e9fa07
			elif ! rtl_fetch_urls_git	\
e9fa07
					"${BUILD_DLCACHEDIR}/${PKG_NAME}" "${DEFAULT_GIT_ARGS}" "${PKG_BASE_DIR}"\
e9fa07
					"${PKG_NAME}" "${PKG_MIRRORS_GIT:-}" ${PKG_URLS_GIT}; then
e9fa07
				return 1;
e9fa07
			fi;
e9fa07
		fi;
e9fa07
e9fa07
		rtl_fetch_clean_dlcache				\
e9fa07
			"${BUILD_DLCACHEDIR}" "${PKG_NAME}"	\
e9fa07
			"${PKG_FNAME:-}" "${PKG_URLS_GIT:-}";
e9fa07
	fi;
e9fa07
e9fa07
	return 0;
e9fa07
};
e9fa07
64844b
# vim:filetype=sh textwidth=0