PDA

View Full Version : TIP: Hacking a DEB Package With dpkg-deb


bhobjj
09-04-2006, 06:09 PM
TIP: Hacking a DEB Package With dpkg-deb


Sometimes, a deb will have the wrong (or unnecessary) dependency information in the package, or you may just want to change it for some other reason. With dpkg-deb, you can hack a deb package.

WARNING: You could break things by doing this.

You can use dpkg-deb to edit the package and change its dependencies.

Extract the filesystem tree to a directory "packagename.x.x.x":
$ dpkg-deb -x packagename.x.x.x.deb packagename.x.x.x

Extract the control file information:
$ dpkg-deb -e packagename.x.x.x.deb packagename.x.x.x/DEBIAN


$ cd packagename.x.x.x/DEBIAN

Edit the file called: control

Change the desired version number for the dependency that you want to change.

$ cd ../../

Rebuild the deb package:
$ dpkg-deb -b packagename.x.x.x packagename.x.x.x.deb


Reference:
man dpkg-deb

bluesdog
09-04-2006, 08:19 PM
Very cool! I only wish you had posted this a day earlier ;)

The latest nvidia-glx-1.0.8774-1 seems a likely candidate for a bit of hacking.

See my post here (http://www.linuxagora.com/vbforum/showthread.php?p=1769#post1769) regarding my latest battle with nvidia...

I suppose I'll have to remove the unused nvidia-kernel module, allow it to also remove nvidia-glx, and then re-install nvidia-glx using the hacked version.
Is that correct?

Excellent how-to!

jjmac
10-27-2006, 06:03 AM
A deb package is really an 'ar' file, so just by using 'ar' and 'tar' and unpacking into a working directory ... placing the control and install/remove scripts in a sub dir called 'DEBIAN' ... The whole thing can be edited.


Back porting/updating using the 'dpkg-source' and 'dpkg-buildpakage' facilities can be very useful as well. Saves having to do big overall package upgrades. Especially if your on dial up. Breakage will depend on what pakage your working of course and can easily be backed out of.

My, somewhat hybrid sarge runs very well :)


jm