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 ..
)
<br />
rus@absinthe:~/$ mkdir phplibs<br />
rus@absinthe:~/$ mv phplibs_1.0-1_i386.deb phplibs<br />
rus@absinthe:~/$ cd phplibs<br />
rus@absinthe:~/phplibs$ ar xv phplibs_1.0-1_i386.deb<br />
x - debian-binary<br />
x - control.tar.gz<br />
x - data.tar.gz<br />
rus@absinthe:~/phplibs$ ls<br />
control.tar.gz data.tar.gz phplibs_1.0-1_i386.deb debian-binary<br />
The control.tar.gz is the one that contains all our precious arch information, so we must extract it!
<br />
rus@absinthe:~/phplibs$ tar -xzf control.tar.gz<br />
rus@absinthe:~/phplibs$ ls<br />
control control.tar.gz data.tar.gz phplibs_1.0-1_i386.deb debian-binary md5sums<br />
open up the control file and edit in the arch you want (in our case, all)
<br />
Package: phplibs<br />
Version: 1.0-2<br />
Section: unknown<br />
Priority: optional<br />
Architecture: all<br />
Installed-Size: 12<br />
Maintainer: rus <rus@internet.com><br />
Description: shared PHP libraries<br />
Required system php libs<br />
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.
<br />
rus@absinthe:~/phplibs$ rm control.tar.gz<br />
rus@absinthe:~/phplibs$ tar -czf control.tar.gz control md5sums<br />
We now just need to use ar again to create our debian package!
<br />
rus@absinthe:~/phplibs$ ar -r phplibs_1.0-2_all.deb debian-binary control.tar.gz data.tar.gz<br />
ar: creating phplibs_1.0-2_all.deb<br />
And there we have it, a shiny new package of arch all that can be installed anywhere!



No comments yet.