Changing deb package architecture February 5, 2008

Posted by idimmu in linux.
We have several PHP applications and libraries incorrectly packaged for i386 rather than all, which means they wont install to our nice new shiny AMD64 servers. Unfortunately we don't have (or at least we can't find) the original package sources, so we need to 'frobble' the packages and change the arch by hand!

Deb files are just an ar package so we must first extract it! (FYI ar is like tar, but for pirates .. :( )


rus@absinthe:~/$ mkdir phplibs
rus@absinthe:~/$ mv phplibs_1.0-1_i386.deb phplibs
rus@absinthe:~/$ cd phplibs
rus@absinthe:~/phplibs$ ar xv phplibs_1.0-1_i386.deb
x - debian-binary
x - control.tar.gz
x - data.tar.gz
rus@absinthe:~/phplibs$ ls
control.tar.gz data.tar.gz phplibs_1.0-1_i386.deb debian-binary


The control.tar.gz is the one that contains all our precious arch information, so we must extract it!


rus@absinthe:~/phplibs$ tar -xzf control.tar.gz
rus@absinthe:~/phplibs$ ls
control control.tar.gz data.tar.gz phplibs_1.0-1_i386.deb debian-binary md5sums


open up the control file and edit in the arch you want (in our case, all)


Package: phplibs
Version: 1.0-2
Section: unknown
Priority: optional
Architecture: all
Installed-Size: 12
Maintainer: rus <rus@internet.com>
Description: shared PHP libraries
Required system php libs


I'm going to increment the package version to -2 as well to signify that it's just the packaging that has changed.

Now we delete the original control.tar.gz file and rebuild it.


rus@absinthe:~/phplibs$ rm control.tar.gz
rus@absinthe:~/phplibs$ tar -czf control.tar.gz control md5sums


We now just need to use ar again to create our debian package!


rus@absinthe:~/phplibs$ ar -r phplibs_1.0-2_all.deb debian-binary control.tar.gz data.tar.gz
ar: creating phplibs_1.0-2_all.deb


And there we have it, a shiny new package of arch all that can be installed anywhere!

Tags

Friends

twitter

  • @jooli2 I just wanted to see what @dpashley looked like after a pint of the black stuff, turns out he looks ugly!
  • looking forwards to performing at Burning The Clocks next Wednesday :o Come all and come watch!
  • @journoannie are they giant sad puppy eyes, as that could be kind of cute? Although the whole self pity thing is a bit of a turn off!
  • Elgg 1.8 Tidypics Group Fix http://t.co/C2D56UsH
  • BackupPC ping too slow http://t.co/9Na2PxKs

lastfm

  • Bogart Shwadchuck – Bitch Go Buy Me A Hot Dog (I'll Be Waiting Here, Doing The Robot)
  • Ill Nillas – What Up Bitches
  • M9 – Mental Prison (Feat. Phoenix Da Icefire) (Produced By Chemo)
  • Therapy? – A Moment Of Clarity
  • Therapy? – Unbeliever
  • Therapy? – Die Laughing
  • Finger Eleven – Swallowtail
  • Equilibrium – Mana
  • Equilibrium – Dämmerung
  • Equilibrium – Ruf In Den Wind

IdleRPG Stats

  • 1 webvictim 57
  • 2 HRH_H_Crab 57