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() {
Lucio Andrés Illanes Albornoz 2b85d0
	local _fname="${1}";
Lucio Andrés Illanes Albornoz 2b85d0
	if [ "${1##*.tar.}" != "${1}" ]; then
Lucio Andrés Illanes Albornoz b6a9a1
		printf "%s" "${1##*.tar.}";
Lucio Andrés Illanes Albornoz 2b85d0
	elif [ "${1##*.t}" != "${1}" ]; then
Lucio Andrés Illanes Albornoz b6a9a1
		printf "%s" "${1##*.t}";
Lucio Andrés Illanes Albornoz 2b85d0
	fi;
Lucio Andrés Illanes Albornoz 2b85d0
};
Lucio Andrés Illanes Albornoz 2b85d0
Lucio Andrés Illanes Albornoz (arab, vxp) c27bea
pkg_fetch_extract() {
Lucio Andrés Illanes Albornoz e1d469
	if [ -n "${PKG_URL:-}" ]; then
Lucio Andrés Illanes Albornoz bf9edf
		_oldpwd="${PWD}";
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
Lucio Andrés Illanes Albornoz bf9edf
			rtl_fileop cd "${_oldpwd}"; return 1;
Lucio Andrés Illanes Albornoz bf9edf
		else
Lucio Andrés Illanes Albornoz bf9edf
			case "$(pkgp_fetch_extract_type "${PKG_NAME}")" 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;
Lucio Andrés Illanes Albornoz bf9edf
			if [ "${?}" -ne 0 ]; then
Lucio Andrés Illanes Albornoz bf9edf
				rtl_fileop cd "${_oldpwd}"; return 1;
Lucio Andrés Illanes Albornoz bf9edf
			else
Lucio Andrés Illanes Albornoz bf9edf
				rtl_fileop cd "${_oldpwd}";
Lucio Andrés Illanes Albornoz bf9edf
			fi;
Lucio Andrés Illanes Albornoz bf9edf
		fi;
Lucio Andrés Illanes Albornoz a53c26
	fi;
Lucio Andrés Illanes Albornoz (arab, vxp) 570129
};
Lucio Andrés Illanes Albornoz (arab, vxp) 570129
Lucio Andrés Illanes Albornoz (arab, vxp) 570129
# vim:filetype=sh