On Thursday 21 June 2007 10:41:02 pm Chris Pemberton wrote:
I looked at /etc/rc.fix and I read it as follows:
For (every directory in /usr/lib/X11/fonts/) { if (fonts.dir is missing) { run mkfontdir; run mkfontscale; } {
So adding more fonts to an *existing* directory in /usr/lib/X11/fonts/ will *not* trigger mkfontdir and mkfontscale..
On the flip side, if a *new* directory is added in /usr/lib/X11/fonts/, then mkfontdir and mkfontscale will run in that directory.
The mkfontdir man page says the first line in fonts.dir is the number of fonts in that directory. So, could we simply check to see if the number of fonts in the directory has changed, and if so, run mkfontdir and mkfontscale?
Or even better, we could compare the mtime of the font directory with the mtime of the fonts.dir file. If a font is added/removed from the directory without running mkfontdir, the mtime of the directory will be newer than the fonts.dir file: if [ -d /usr/lib/X11/fonts ]; then for i in `/bin/ls -d /usr/lib/X11/fonts/*`; do if [ 0"`stat -c %Y $i/fonts.dir 2>/dev/null`" -lt 0"`stat -c %Y $i`" ]; then mkfontdir $i &> /dev/null mkfontscale $i &> /dev/null fi done fi This will work even if you add and remove fonts without changing the number of fonts at the end (as opposed to the first line solution). I don't even have this script in my system, because I haven't updated my "rc" package in ages (too many customizations), neither the "filesystem" package, because it just looks scary. I don't mind updating glibc though ;) If we are going to update the "rc" package, may I propose some enhacements: Transforming the SERVICES array to a list. I mean: -SERVICES=(net crond) +SERVICES="net crond" Then we could change the interpreter from /bin/bash to /bin/sh in every rc script, and make /bin/sh a symlink to /bin/mksh. mksh is faster and requires less memory than bash. I think bash should only be used for interactive shells, or only if really needed. If we are making mksh the default /bin/sh, we should also change the interpreter in ldd to bash, since that really requires bash. These changes are one of the first things I do whenever I install a new system. There are no drawbacks, only benefits: faster shellscripts, fewer memory usage, and most important, it will make arnuld happy ;) -- Alan Mizrahi