Blame subr/pkg_extract.subr

Lucio Andrés Illanes Albornoz (arab, vxp) 570129
#
Lucio Andrés Illanes Albornoz (arab, vxp) 570129
# . ./build.vars and set -o errexit -o noglob are assumed.
Lucio Andrés Illanes Albornoz (arab, vxp) 570129
# See warning at the top of build.vars.
Lucio Andrés Illanes Albornoz (arab, vxp) 570129
#
Lucio Andrés Illanes Albornoz (arab, vxp) 570129
Lucio Andrés Illanes Albornoz (arab, vxp) 570129
pkg_extract() {
Lucio Andrés Illanes Albornoz (arab, vxp) 03a637
	if [ -n "${PKG_URL}" ]\
Lucio Andrés Illanes Albornoz (arab, vxp) 03a637
	&& [ "${PKG_URL_TYPE:-wget}" = wget ]; then
Lucio Andrés Illanes Albornoz (arab, vxp) bd97b6
		build_fileop rm ${PKG_SUBDIR};
Lucio Andrés Illanes Albornoz (arab, vxp) 570129
		if [ ${PKG_SUBDIR_CREATE:-0} -eq 1 ]; then
Lucio Andrés Illanes Albornoz (arab, vxp) bd97b6
			build_fileop mkdir ${PKG_SUBDIR};
Lucio Andrés Illanes Albornoz (arab, vxp) 570129
		fi;
Lucio Andrés Illanes Albornoz (arab, vxp) 570129
		if [ "${PKG_FNAME##*.tar.}" = "bz2" ]; then
Lucio Andrés Illanes Albornoz (arab, vxp) 570129
			bunzip2 -d < ${DLCACHEDIR}/${PKG_FNAME} | tar ${PKG_SUBDIR_CREATE:+-C ${PKG_SUBDIR}} -xf -;
Lucio Andrés Illanes Albornoz (arab, vxp) 570129
		elif [ "${PKG_FNAME##*.tar.}" = "gz" ]; then
Lucio Andrés Illanes Albornoz (arab, vxp) 570129
			gunzip -d < ${DLCACHEDIR}/${PKG_FNAME} | tar ${PKG_SUBDIR_CREATE:+-C ${PKG_SUBDIR}} -xf -;
Lucio Andrés Illanes Albornoz (arab, vxp) 570129
		elif [ "${PKG_FNAME##*.tar.}" = "xz" ]; then
Lucio Andrés Illanes Albornoz (arab, vxp) 570129
			xz -d < ${DLCACHEDIR}/${PKG_FNAME} | tar ${PKG_SUBDIR_CREATE:+-C ${PKG_SUBDIR}} -xf -;
Lucio Andrés Illanes Albornoz (arab, vxp) 570129
		elif [ "${PKG_FNAME##*.t}" = "bz2" ]; then
Lucio Andrés Illanes Albornoz (arab, vxp) 570129
			bunzip2 -d < ${DLCACHEDIR}/${PKG_FNAME} | tar ${PKG_SUBDIR_CREATE:+-C ${PKG_SUBDIR}} -xf -;
Lucio Andrés Illanes Albornoz (arab, vxp) 570129
		elif [ "${PKG_FNAME##*.t}" = "gz" ]; then
Lucio Andrés Illanes Albornoz (arab, vxp) 570129
			gunzip -d < ${DLCACHEDIR}/${PKG_FNAME} | tar ${PKG_SUBDIR_CREATE:+-C ${PKG_SUBDIR}} -xf -;
Lucio Andrés Illanes Albornoz (arab, vxp) 570129
		elif [ "${PKG_FNAME##*.t}" = "xz" ]; then
Lucio Andrés Illanes Albornoz (arab, vxp) 570129
			xz -d < ${DLCACHEDIR}/${PKG_FNAME} | tar ${PKG_SUBDIR_CREATE:+-C ${PKG_SUBDIR}} -xf -;
Lucio Andrés Illanes Albornoz (arab, vxp) 570129
		else
Lucio Andrés Illanes Albornoz (arab, vxp) 570129
			tar ${PKG_SUBDIR_CREATE:+-C ${PKG_SUBDIR}} -xf ${DLCACHEDIR}/${PKG_FNAME};
Lucio Andrés Illanes Albornoz (arab, vxp) 570129
		fi;
Lucio Andrés Illanes Albornoz (arab, vxp) 570129
		if test_cmd pkg_${PKG_NAME}_extract_post; then
Lucio Andrés Illanes Albornoz (arab, vxp) 570129
			pkg_${PKG_NAME}_extract_post;
Lucio Andrés Illanes Albornoz (arab, vxp) 570129
		fi;
Lucio Andrés Illanes Albornoz (arab, vxp) 570129
	fi;
Lucio Andrés Illanes Albornoz (arab, vxp) 570129
	set_build_script_done extract -build_dir;
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