Wednesday, September 7, 2011

Small script for fixing mp4box installation

Every time Xulrunner gets updated on my ubuntu box, my mp4box installation breaks. The reason for this is that installing mp4box from source (the only real option, since it's not available in the repositories, at least not on 10.04) requires updating /etc/ld.so.conf by adding a line like
"/usr/lib/xulrunner-1.9.2.22/"
So that mp4box can find and load mozilla's javascript libraries. The problem is that every time Xulrunner gets upgraded, the version number changes, and ld.so.conf needs to be updated again with the new version number. While this isn't actually hard, it is tedious, plus I always have to look up which config file to edit, find out the new version of Xulrunner I've just installed, etc.
It's just slightly irritating.

So I made a script. I saved the following in /usr/bin/mp4boxupdate

#!/bin/bash
sed -i.bak -e "s/\/usr\/lib\/xulrunner-[0-9.]*/\/usr\/lib\/xulrunner-`xulrunner --gre-version`/" /etc/ld.so.conf
ldconfig

Now updating /etc/ld/so.conf is just a simple matter of running "sudo mp4boxupdate"

Of course, the ideal solution would be if mp4box were available in the repositories - then the package manager could do all these updates for us. Until then, I'll just use this workaround.

No comments:

Post a Comment