Tuesday, 11 February 2014

REPACKING OF DEB FILES ON DEBIAN AND UBUNTU

The following tutorial will teach Ubuntu, Linux Mint and Debian GNU/Linux users how to easily unpack and repack a .deb file on their Debian-based Linux operating system.

mkdir -p extract/DEBIAN
dpkg-deb -x package.deb extract/
dpkg-deb -e package.deb extract/DEBIAN [...do something, e.g. edit the control file...]
mkdir build
dpkg-deb -b extract/ build/

These five commands will do the job like a charm. Let me explain them to you: the first one creates a folder called "extract" and a subfolder called "DEBIAN"; 
The second command will extract some files from your .deb package in the "extract" folder; 

The third command will extract the content of the .deb package in the "DEBIAN" subfolder, where you can modify/patch the files you want; 

The fourth command will create a folder called "build"; and the fifth command will repack the modified files into a new .deb package, which will be generated in the "build" folder.