[Frugalware-darcs] pacman-g2: makepkg: added Fextract function from util.sh

VMiklos vmiklos at frugalware.org
Fri Jun 15 18:59:14 CEST 2007


Darcsweb-Url: http://darcs.frugalware.org/darcsweb/darcsweb.cgi?r=pacman-g2;a=darcs_commitdiff;h=20070615164357-e2957-22bc573ba9baa9414b83e25c8bde6facdd5cafb8.gz;

[makepkg: added Fextract function from util.sh
VMiklos <vmiklos at frugalware.org>**20070615164357
 this way makepkg still functional if fst is not installed (pvided that the
 buildscripts does not use fst)
] {
hunk ./scripts/makepkg 58
+
+# compat functions. these are useful if one would like to use makepkg outside
+# FST. if you want to modify these, please submit a patch again FST first
+
+###
+# * Fextract(): Extract archives. Parameter: file name to extract. Example:
+# Fextract pacman.tar.gz.
+###
+Fextract() {
+	local cmd file tmp
+	file="${1}"
+	tmp="$(echo "${file}" | tr 'A-Z' 'a-z')"
+	case "${tmp}" in
+		*.tar.gz|*.tar.z|*.tgz)
+		cmd="tar --use-compress-program=gzip -xf $file" ;;
+		*.tar.bz2|*.tbz2)
+		cmd="tar --use-compress-program=bzip2 -xf $file" ;;
+		*.tar)
+		cmd="tar -xf $file" ;;
+		*.zip)
+		unziphack=1
+		cmd="unzip -qqo $file" ;;
+		*.cpio.gz)
+		cmd="bsdtar -x -f $file" ;;
+		*.cpio.bz2)
+		cmd="bsdtar -x -f $file" ;;
+		*.gz)
+		cmd="gunzip -f $file" ;;
+		*.bz2)
+		cmd="bunzip2 -f $file" ;;
+		*)
+		cmd="" ;;
+	esac
+	if [ "$cmd" != "" ]; then
+		msg "    $cmd"
+		$cmd
+		if [ $? -ne 0 ]; then
+			# unzip will return a 1 as a warning, it is not an error
+			if [ "$unziphack" != "1" -o $? -ne 1 ]; then
+				error "Failed to extract ${file}"
+				msg "Aborting..."
+				Fdie
+			fi
+		fi
+	fi
+}
}


More information about the Frugalware-darcs mailing list