All pastes #674566 Raw Edit

Mine

public shellscript v1 · immutable
#674566 ·published 2007-08-29 11:08 UTC
rendered paste body
#!/bin/sh# Utility to convert a debian package to .tar.gz.# Part of the script adapted from rpm2targz script from Slackware# By Tushar Teredesai <tush@yahoo.com>if [ "$1" = "" ]then	echo "$0:  Converts a debian package to a GNU tar+gz format."	echo "Also preserves the debian control scripts."	echo "Usage: $0 <file.deb>"	exit 1;fifor i in $*do	# Output progress only if multiple files are being converted.	if [ ! "$1" = "$*" ]	then		echo "Processing file: $i"	fi	# Tmp dir to store intermediate files	tmpdir=/tmp/deb2targz.$$	# Better be safe than sorry	rm -rf ${tmpdir}	# Create tmp directory	mkdir $tmpdir || exit 1	# Xtract the data portion	ar p ${i} data.tar.gz | gunzip > ${tmpdir}/data.tar	# Xtract the data portion	ar p ${i} control.tar.gz | gunzip > ${tmpdir}/control.tar	# Merge the two tar balls	tar --concatenate --file=${tmpdir}/data.tar ${tmpdir}/control.tar	# Gzip it.	cat ${tmpdir}/data.tar | gzip -9 > `basename ${i} .deb`.tar.gz || exit 1	# Remove the tmp files	rm -rf ${tmpdir}done