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: rusDescription: 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!