Conan_Kudo / build / midipix_build

Forked from build/midipix_build 4 years ago
Clone

Blame subr/pkg_fetch_extract.subr

Lucio Andrés Illanes Albornoz (arab, vxp) 570129
#
Lucio Andrés Illanes Albornoz 2b85d0
# set +o errexit -o noglob 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 2b85d0
		echo "${1##*.tar.}";
Lucio Andrés Illanes Albornoz 2b85d0
	elif [ "${1##*.t}" != "${1}" ]; then
Lucio Andrés Illanes Albornoz 2b85d0
		echo "${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 aa37e6
	if [ -n "${PKG_URL}" ]; then
Lucio Andrés Illanes Albornoz c6d6e0
		_oldpwd="${PWD}"; rtl_fileop cd "${PKG_BASE_DIR}" || return "${?}";
Lucio Andrés Illanes Albornoz c6d6e0
		rtl_fileop rm "${PKG_BASE_DIR}/${PKG_SUBDIR}" || return "${?}";
Lucio Andrés Illanes Albornoz 2b85d0
		case "$(pkgp_fetch_extract_type "${PKG_NAME}")" in
Lucio Andrés Illanes Albornoz 2b85d0
		bz2)	bunzip2 -d < "${BUILD_DLCACHEDIR}/${PKG_FNAME}" | tar -C "${PKG_BASE_DIR}" -xf - || return "${?}"; ;;
Lucio Andrés Illanes Albornoz 2b85d0
		gz)	gunzip -d < "${BUILD_DLCACHEDIR}/${PKG_FNAME}" | tar -C "${PKG_BASE_DIR}" -xf - || return "${?}"; ;;
Lucio Andrés Illanes Albornoz 2b85d0
		lz)	lzip -d < "${BUILD_DLCACHEDIR}/${PKG_FNAME}" | tar -C "${PKG_BASE_DIR}" -xf - || return "${?}"; ;;
Lucio Andrés Illanes Albornoz 2b85d0
		xz)	xz -d < "${BUILD_DLCACHEDIR}/${PKG_FNAME}" | tar -C "${PKG_BASE_DIR}" -xf - || return "${?}"; ;;
Lucio Andrés Illanes Albornoz 2b85d0
		*)	tar -C "${PKG_BASE_DIR}" -xf "${BUILD_DLCACHEDIR}/${PKG_FNAME}" || return "${?}"; ;;
Lucio Andrés Illanes Albornoz 2b85d0
		esac;
Lucio Andrés Illanes Albornoz c6d6e0
		rtl_fileop cd "${_oldpwd}" || return "${?}";
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