From e1011ac39bcda2ecf00173269d443037d5f74d93 Mon Sep 17 00:00:00 2001 From: "B. Watson" Date: Sun, 5 Jul 2020 21:51:38 -0400 Subject: Rename deb2tgz => deb2tarball --- deb2tarball | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) create mode 100755 deb2tarball (limited to 'deb2tarball') diff --git a/deb2tarball b/deb2tarball new file mode 100755 index 0000000..145f58d --- /dev/null +++ b/deb2tarball @@ -0,0 +1,26 @@ +#!/bin/sh + +INPUT="$1" + +if [ -z "$INPUT" -o "$INPUT" = "--help" ]; then + echo "deb2tarball by B. Watson , WTFPL" + echo "Usage: `basename $0` filename.deb" + exit 0 +fi + +# used to always be data.tar.gz, newer debs might have data.tar.xz, +# so we have to check. ar doesn't support wildcards like tar does, so +# we can't just say "data.tar.*". + +DATA="$( ar t "$INPUT" 2>/dev/null | grep '^data\.tar\.' )" + +if [ -z "$DATA" ]; then + echo "Can't find any data.tar.* file(s) in the archive, invalid deb?" 2>&1 + exit 1 +fi + +EXT="$( echo $DATA | cut -d. -f2- )" +OUTPUT="`basename $1 .deb`".$EXT + +echo "$OUTPUT" +ar p "$INPUT" "$DATA" > "$OUTPUT" -- cgit v1.2.3