diff options
author | B. Watson <yalhcru@gmail.com> | 2020-06-01 13:39:39 -0400 |
---|---|---|
committer | B. Watson <yalhcru@gmail.com> | 2020-06-01 13:39:39 -0400 |
commit | 135b6988a809f22a633d9a90273cd6447cfa85be (patch) | |
tree | f4a05436f1db203e0a2ccf80b70d959f6faffcd6 /deb2tgz | |
parent | 722e9a7b6816c960ff1e02b352dfb909983e8f1b (diff) | |
download | misc-scripts-135b6988a809f22a633d9a90273cd6447cfa85be.tar.gz |
add deb2tgz
Diffstat (limited to 'deb2tgz')
-rwxr-xr-x | deb2tgz | 24 |
1 files changed, 24 insertions, 0 deletions
@@ -0,0 +1,24 @@ +#!/bin/sh + +INPUT="$1" + +if [ -z "$INPUT" -o "$INPUT" = "--help" ]; then + echo "deb2tgz by B. Watson <yalhcru@gmail.com>, WTFPL" + echo "Usage: `basename $0` filename.deb" + exit 0 +fi + +OUTPUT="`basename $1 .deb`.tgz" + +# 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 + +ar p "$INPUT" "$DATA" > $OUTPUT |