deb2targz - convert .deb files to .tar.gz

22nd October 2011

Inspired by someone's cry for help on the Red Hat mailing list, and by my own need to stop Debian trying to run my life for me, I wrote a simple Perl-script, deb2targz, in the spirit of the neatly hacked-up Perl version of rpm2cpio, to convert Debian Linux's .deb package files into the nice, convenient .tar.gz tarballs that we all know and love.

You can download deb2targz here.

Update - 6th July 2006

Felix Wiemann has pointed out that there is a package called alien that does this, and more.

Update - 22nd October 2011


It turns out to be complete waste of time: Debian packages are ar achives, and can be inspected and unpacked using the standard Unix command-line utility ar as follows:

$ ls -l google-musicmanager-beta_current_i386.deb
-rw-r--r-- 1 mike mike 2991982 2011-10-21 08:37
$ ar tv google-musicmanager-beta_current_i386.deb
rw-r--r-- 0/0      4 Sep 14 21:12 2011 debian-binary
rw-r--r-- 0/0   4688 Sep 14 21:12 2011 control.tar.gz
rw-r--r-- 0/0 2987102 Sep 14 21:12 2011 data.tar.lzma
$ ar xv google-musicmanager-beta_current_i386.deb
x - data.tar.lzma
$ ls -l data.tar.lzma
-rw-r--r-- 1 mike mike 2987102 2011-10-21 08:39 data.tar.lzma

(I would remove the script completely, but Aram Ayazyan tells me that it is used by packages in Arch Linux.)

Update - 16th February 2012

Michael Haubenwallner pointed out to me that:

There's another reason to keep deb2targz alive, for completion: Using 'ar' to read .deb packages does work for many Unices, but not all of them, as there is no defined standard for the ar file format. AIX uses a different ar file format, so using 'ar' does not work there. And using 'alien' feels like too much overhead in some cases.

So I won't be taking deb2targz down.

Feedback to <> is welcome!