Recompressing a .deb package

Date: 26 Oct, 2012
Posted by: admin
In: hints & tips|linux, open source & software

Bookmark and Share

Decompressed a .deb package and thought that recompressing would be as simple, but it’s not. Here’s what to do.

Decompression sickness

Unzip/untar and fiddle

The package I was looking at was google-talkplugin_current_amd64.deb to enable video casting via YouTube. Looking at the package contents I noticed a cron job I didn’t really want to run every day (auto updates presumably without asking at install) and some language files that apt-get normally removes for me (via localepurge). So I thought I’d modify the package.

Simple but wrong

I simply unzipped, the package, unzipped the data.tar.gz, removed the files from the tree that I didn’t want, compressed the file tree back as data.tar.gz and then swapped the data.tar.gz via ark [archive manager for KDE] for the old one. Unfortunately that doesn’t then install:

$ dpkg-deb -I google-talkplugin_current_amd64.deb
dpkg-deb: error: `google-talkplugin_current_amd64.deb' is not a debian format archive

Constructing a deb package the right way

So, what you should do is make a directory structure like so:

google-talkplugin_current_amd64
|– DEBIAN
| |– control
| |– debian-binary
| |– md5sums
| |– postinst
| `– postrm
|– opt
| `– google
| `– talkplugin
| |– attributions.txt
| |– data
| | |– LMprec_508.emd
| | |– MFTprec_120.emd
| | `– SFTprec_120.emd
| |– GoogleTalkPlugin
| |– lib
| | |– libCgGL.so
| | `– libCg.so
| |– libgoogletalkremoting.so
| |– libnpgoogletalk.so
| |– libnpgtpo3dautoplugin.so
| |– locale
| | |– en
| | | `– LC_MESSAGES
| | | `– windowpicker.mo
| | `– en-GB
| | `– LC_MESSAGES
| | `– windowpicker.mo
| `– windowpicker.glade
`– usr
|– lib
| |– firefox
| | `– plugins
| | |– libnpgoogletalk.so -> /opt/google/talkplugin/libnpgoogletalk.so
| | `– libnpgtpo3dautoplugin.so -> /opt/google/talkplugin/libnpgtpo3dautoplugin.so
| |– mozilla
| | `– plugins
| | |– libnpgoogletalk.so -> /opt/google/talkplugin/libnpgoogletalk.so
| | `– libnpgtpo3dautoplugin.so -> /opt/google/talkplugin/libnpgtpo3dautoplugin.so
| |– xulrunner
| | `– plugins
| | |– libnpgoogletalk.so -> /opt/google/talkplugin/libnpgoogletalk.so
| | `– libnpgtpo3dautoplugin.so -> /opt/google/talkplugin/libnpgtpo3dautoplugin.so
| `– xulrunner-addons
| `– plugins
| |– libnpgoogletalk.so -> /opt/google/talkplugin/libnpgoogletalk.so
| `– libnpgtpo3dautoplugin.so -> /opt/google/talkplugin/libnpgtpo3dautoplugin.so
`– share
`– doc
`– google-talkplugin
`– changelog.Debian.gz

Notes

  1.  contents of  the original control.tar.gz that were extracted have been put in a folder DEBIAN.
  2. the contents of data.tar.gz have been put in the root of the packages folder
  3. Erm, that’s kinda it.

Build the package

Use the command:

$ dpkg-deb -b google-talkplugin_current_amd64 google-talkplugin_current_amd64.deb

Which is dpkg-deb -b [or –build] followed by the directory holding the package files and the name for the package. If you did it right should give a response like

dpkg-deb: building package `google-talkplugin’ in `google-talkplugin_current_amd64.deb’.

Then you just install as normal (I use gdebi-gtk by just clicking on the package in my file manager [dolphin]). Happy packing.

One Responses to "Recompressing a .deb package"

[…] I followed my own post on rebuilding deb packages in order to fix it. Simply decompressed the package, remove “bluez-alsa” from the […]


About

Flapjacktastic is just a random collection of musings, hints&tips, notes, information ... a collection of stuff really that's overflowed from the brain of this husband, father, potter, business-man, geek ...

past posts