Lucio Andrés Illanes Albornoz (arab, vxp) 570129
#
Lucio Andrés Illanes Albornoz e1d469
# set +o errexit -o noglob -o nounset is assumed.
Lucio Andrés Illanes Albornoz (arab, vxp) 570129
#
Lucio Andrés Illanes Albornoz (arab, vxp) 570129
Lucio Andrés Illanes Albornoz 2b85d0
pkgp_fetch_extract_type() {
e9fa07
	local _ppfet_fname="${1}" _ppfet_rtype="${2#\$}";
e9fa07
Lucio Andrés Illanes Albornoz 2b85d0
	if [ "${1##*.tar.}" != "${1}" ]; then
e9fa07
		eval ${_ppfet_rtype}='${1##*.tar.}';
Lucio Andrés Illanes Albornoz 2b85d0
	elif [ "${1##*.t}" != "${1}" ]; then
e9fa07
		eval ${_ppfet_rtype}='${1##*.t}';
Lucio Andrés Illanes Albornoz 2b85d0
	fi;
e9fa07
	return 0;
Lucio Andrés Illanes Albornoz 2b85d0
};
Lucio Andrés Illanes Albornoz 2b85d0
Lucio Andrés Illanes Albornoz (arab, vxp) c27bea
pkg_fetch_extract() {
e9fa07
	local	_pfe_group_name="${1}" _pfe_pkg_name="${2}" _pfe_restart_at="${3}"	\
e9fa07
		_pfe_type="";
e9fa07
e9fa07
	if [ "${PKG_URL:+1}" = 1 ]; then
e9fa07
		_pfe_oldpwd="${PWD}";
e9fa07
Lucio Andrés Illanes Albornoz bf9edf
		if ! rtl_fileop cd "${PKG_BASE_DIR}"\
Lucio Andrés Illanes Albornoz bf9edf
		|| ! rtl_fileop rm "${PKG_BASE_DIR}/${PKG_SUBDIR}"; then
e9fa07
			rtl_fileop cd "${_pfe_oldpwd}"; return 1;
Lucio Andrés Illanes Albornoz bf9edf
		else
e9fa07
			pkgp_fetch_extract_type "${PKG_NAME}" \$_pfe_type;
e9fa07
e9fa07
			case "${_pfe_type}" in
Lucio Andrés Illanes Albornoz 10ff54
			bz2)	bunzip2 -d < "${BUILD_DLCACHEDIR}/${PKG_NAME}/${PKG_FNAME}" | tar -C "${PKG_BASE_DIR}" -xf -; ;;
Lucio Andrés Illanes Albornoz 10ff54
			gz)	gunzip -d < "${BUILD_DLCACHEDIR}/${PKG_NAME}/${PKG_FNAME}" | tar -C "${PKG_BASE_DIR}" -xf -; ;;
Lucio Andrés Illanes Albornoz 10ff54
			lz)	lzip -d < "${BUILD_DLCACHEDIR}/${PKG_NAME}/${PKG_FNAME}" | tar -C "${PKG_BASE_DIR}" -xf -; ;;
Lucio Andrés Illanes Albornoz 10ff54
			xz)	xz -d < "${BUILD_DLCACHEDIR}/${PKG_NAME}/${PKG_FNAME}" | tar -C "${PKG_BASE_DIR}" -xf -; ;;
Lucio Andrés Illanes Albornoz 10ff54
			*)	tar -C "${PKG_BASE_DIR}" -xf "${BUILD_DLCACHEDIR}/${PKG_NAME}/${PKG_FNAME}"; ;;
Lucio Andrés Illanes Albornoz bf9edf
			esac;
e9fa07
Lucio Andrés Illanes Albornoz bf9edf
			if [ "${?}" -ne 0 ]; then
e9fa07
				rtl_fileop cd "${_pfe_oldpwd}"; return 1;
Lucio Andrés Illanes Albornoz bf9edf
			else
e9fa07
				rtl_fileop cd "${_pfe_oldpwd}";
Lucio Andrés Illanes Albornoz bf9edf
			fi;
Lucio Andrés Illanes Albornoz bf9edf
		fi;
Lucio Andrés Illanes Albornoz a53c26
	fi;
e9fa07
e9fa07
	return 0;
Lucio Andrés Illanes Albornoz (arab, vxp) 570129
};
Lucio Andrés Illanes Albornoz (arab, vxp) 570129
64844b
# vim:filetype=sh textwidth=0