Unpacking a .deb file (including scripts)

While attempting to install a deb package on a slackware system I wanted to check the install script that the package runs. I tried the deb2tgz utility but unfortunately that only left me the files in the package in a ready to install .tgz file.

Here’s how to unpack a .deb to obtain both scripts and files:

cd /tmp/somefolder
tar x somepackage.deb

This leaves you with two files:

control.tar.gz and data.tar.gz The first contains the pre and post install scripts and the second contains the files.