deb file structure
19 May 2010
Deb packages are nothing but ar containers, what set them apart (besides the sufix) are the 3 blobs they always contain.
- debian-binary: package version, normally 2.0
- control.tar.gz: compressed package files containing checksums, scripts (http://www.debian.org/doc/FAQ/ch-pkg_basics.html), metadata, etc.
- data.tar.gz: compressed package files containing the program itself (commonly in binary format)
NOTE: Modifying .deb packages directly is not the right way to do it. The formal procedure is described at the Debian packaging guide:
On this example I required to extract some files from firefox-launchpad-plugin. I had already installed firefox from a third party source and Ubuntu wanted to install its own version as a dependency which wasn’t going to happen.
To uncompress deb packages a call to ar is enough:
$ ar xv firefox-launchpad-plugin_0.4_all.deb x - debian-binary x - control.tar.gz x - data.tar.gz
If all you want is to modify the package, you can extract the .tar.gz files, modify them and repackage them with:
$ ar r firefox-launchpad-plugin_0.4_all.deb debian-binary control.tar.gz data.tar.gz ar: creating firefox-launchpad-plugin_0.4_all.deb
On this example however I’ll only copy some files to the file system:
$ tar zxvf data.tar.gz ./ ./usr/ ./usr/lib/ ./usr/lib/firefox-addons/ ./usr/lib/firefox-addons/searchplugins/ ./usr/lib/firefox-addons/searchplugins/launchpad-bug-lookup.xml ./usr/lib/firefox-addons/searchplugins/launchpad-bugs.xml ./usr/lib/firefox-addons/searchplugins/launchpad-package-bugs.xml ./usr/lib/firefox-addons/searchplugins/launchpad-packages.xml ./usr/lib/firefox-addons/searchplugins/launchpad-people.xml ./usr/lib/firefox-addons/searchplugins/launchpad-specs.xml ./usr/lib/firefox-addons/searchplugins/launchpad-support.xml $ find ~/.mozilla/ -type d -iname searchplugins /home/javier/.mozilla/firefox/h5xyzl6e.default/searchplugins $ mv ./usr/lib/firefox-addons/searchplugins/* ~/.mozilla/firefox/h5xyzl6e.default/searchplugins/
Done!, I don’t need to mess with a dependency hell for a bunch of files 😏