Subject: Re: Let "locate" search/index network volumes, too?
To: Robert Elz <kre@munnari.OZ.AU>
From: Frederick Bruckman <fredb@immanent.net>
List: tech-userlevel
Date: 02/02/2004 10:29:16
On Mon, 2 Feb 2004, Robert Elz wrote:

>     Date:        Mon, 2 Feb 2004 08:52:26 -0600 (CST)
>     From:        Frederick Bruckman <fredb@immanent.net>
>     Message-ID:  <Pine.NEB.4.58.0402020810120.204@seduction.immanent.net>
>
>   | Below are my patches to make the locate database construction
>   | configurable in "/etc/weekly.conf".
>
> Looks nice - would be nicer if there was an easy way to change where
> the temp files go during the sort (on some of my systems the lists
> are so big that /var/tmp just can't cope).   Sort can be told to
> use someplace else, but getting this info into updatedb via weekly and
> cron isn't trivial (as in, it isn't hard to do, but means modifying
> things that shouldn't need to be modified).

Actually, "mktemp" puts them in "/tmp", by default, so you must be
changing it already. Doesn't it work to simply set TMPDIR at the top
of root's crontab? (I confess I just thought of that now; what I'd
actually done to run this script was make my "/tmp" bigger.)

>   | The settings look like this:
>   |
>   | rebuild_locatedb=YES locatedb_flags="-local +cd9660 +fdesc +kernfs +procfs"
>
> I think you have - and + backwards, for most people, '-' would mean subtract,
> or leave out, and '+' add in, or include, having them the other way around for
> no particularly good reason is just confusing.

I thought "-" did the usual thing, and "+" does the opposite, as for
example, in the shell, "set -x" turns on debugging, and "set +x" turns
it off. That used to seem backwards to me, too, but I've now embraced
the idea. I could go either way on this -- what do other folks think?

> This is all very pretty fancy code, using sh features in nice
> ways, but, but wouldn't it be simpler to just do
>
> while [ $# -ne 0 ]; do		# or "-gt 0" just to be safe...
> 	case "$1" in
> 	-*)	set ... ;;
> 	+*)	set ... ;;
> 	 *)	set ... ;;
> 	esac
> 	shift
> done

Indeed -- that's what I meant to write. :-)

I actually started using the shell array in a different way, but it
devolved to just appending to the array. It could now be done in
"/bin/sh" by appending to an ordinary variable, then cleaning it up
with "eval find ...", but that makes the test to invoke the default
arguments less pretty. Maybe a flag should just be set in the above
while loop?

Thanks for the comments.

Frederick