diff options
author | Todd C. Miller <millert@cvs.openbsd.org> | 1997-01-04 01:36:02 +0000 |
---|---|---|
committer | Todd C. Miller <millert@cvs.openbsd.org> | 1997-01-04 01:36:02 +0000 |
commit | 8ed127071116c938d28f7f90ce6795b2282e61d1 (patch) | |
tree | f67701163a2901707159e9c995e2516ec2c6f647 /usr.bin/locate | |
parent | 2d078054cd80f6f77396855eeca4d92d3f217e3a (diff) |
Command line args to updatedb. Also, a filename of "-" for the db
means output to stdout.
Diffstat (limited to 'usr.bin/locate')
-rw-r--r-- | usr.bin/locate/locate/locate.updatedb.8 | 31 | ||||
-rw-r--r-- | usr.bin/locate/locate/updatedb.sh | 32 |
2 files changed, 56 insertions, 7 deletions
diff --git a/usr.bin/locate/locate/locate.updatedb.8 b/usr.bin/locate/locate/locate.updatedb.8 index b6aee735a72..938f7dd43b8 100644 --- a/usr.bin/locate/locate/locate.updatedb.8 +++ b/usr.bin/locate/locate/locate.updatedb.8 @@ -1,4 +1,4 @@ -.\" $OpenBSD: locate.updatedb.8,v 1.2 1996/09/15 16:50:39 michaels Exp $ +.\" $OpenBSD: locate.updatedb.8,v 1.3 1997/01/04 01:36:01 millert Exp $ .\" .\" Copyright (c) 1996 .\" Mike Pritchard <mpp@FreeBSD.org>. All rights reserved. @@ -38,19 +38,42 @@ .Nd update locate database .Sh SYNOPSIS .Nm /usr/libexec/locate.updatedb +.Op Fl --tmpdir=dir +.Op Fl --fcodes=dbfile +.Op Fl --searchpaths='dir1 dir2...' +.Op Fl --prunepaths='dir1 dir2...' +.Op Fl --filesystems='type1 type2...' .Sh DESCRIPTION .Nm Locate.updatedb updates the database used by .Xr locate 1 . It is typically run once a week by the -.Nm /etc/weekly script. +.Pa /etc/weekly +script. .Pp The contents of the newly built database can be controlled by the -.Nm /etc/locate.rc file. +.Pa /etc/locate.rc +file as well as the command line arguments. +.Sh OPTIONS +.Bl -tag -width --filesystems +The available options are as follows: +.It Fl --tmpdir +Sets the directory temporary files are stored in. +.It Fl --fcodes +Use the named file as the find codes database. If the file +name ``-'' is given, the database will be sent to standard output. +.It Fl --searchpaths +Sets the list of directories to be put in the database. +.It Fl --prunepaths +Sets the list of parent directories that should not be go in +the database. +.It Fl --filesystems +A list of filesystem types to be traversed by +.Xr find 1 . .Sh FILES .Bl -tag -width /var/db/locate.database -compact .It Pa /var/db/locate.database -the actual database +the default database .It Pa /etc/locate.rc the configuration file .El diff --git a/usr.bin/locate/locate/updatedb.sh b/usr.bin/locate/locate/updatedb.sh index 44869c4af29..6f4d05d08de 100644 --- a/usr.bin/locate/locate/updatedb.sh +++ b/usr.bin/locate/locate/updatedb.sh @@ -1,6 +1,6 @@ #!/bin/sh # -# $OpenBSD: updatedb.sh,v 1.6 1997/01/03 23:33:49 millert Exp $ +# $OpenBSD: updatedb.sh,v 1.7 1997/01/04 01:36:01 millert Exp $ # # Copyright (c) September 1995 Wolfram Schneider <wosch@FreeBSD.org>. Berlin. # All rights reserved. @@ -28,7 +28,7 @@ # # updatedb - update locate database for local mounted filesystems # -# $Id: updatedb.sh,v 1.6 1997/01/03 23:33:49 millert Exp $ +# $Id: updatedb.sh,v 1.7 1997/01/04 01:36:01 millert Exp $ LOCATE_CONFIG="/etc/locate.rc" if [ -f "$LOCATE_CONFIG" -a -r "$LOCATE_CONFIG" ]; then @@ -41,6 +41,7 @@ fi PATH=$LIBEXECDIR:/bin:/usr/bin:$PATH; export PATH +USAGE="Usage: $0 [--tmpdir=dir] [--fcodes=dbfile] [--searchpaths='dir1 dir2...'] [--prunepaths='dir1 dir2...'] [--filesystems='type1 type2...']" : ${mklocatedb=locate.mklocatedb} # make locate database program : ${FCODES=/var/db/locate.database} # the database @@ -49,6 +50,27 @@ PATH=$LIBEXECDIR:/bin:/usr/bin:$PATH; export PATH : ${FILESYSTEMS="ffs"} # allowed filesystems : ${find=find} +# Command line args override rc file and defaults +while test $# != 0; do + option=`echo $1 | sed 's/^\([^=]*\).*$/\1/'` + optarg=`echo $1 | sed 's/^[^=]*=\(.*$\)/\1/'` + + # All options take an argument + if [ "$option" = "$optarg" ]; then + echo "$USAGE" + exit 1 + fi + + case "$option" in + --tmpdir) TMPDIR="$optarg";; + --fcodes) FCODES="$optarg";; + --searchpaths) SEARCHPATHS="$optarg";; + --prunepaths) PRUNEPATHS="$optarg";; + --filesystems) FILESYSTEMS="$optarg";; + esac + shift +done + case X"$SEARCHPATHS" in X) echo "$0: empty variable SEARCHPATHS"; exit 1;; esac case X"$FILESYSTEMS" in @@ -80,7 +102,11 @@ if $find $SEARCHPATHS $excludes -or -print 2>/dev/null | $mklocatedb > $tmp then case X"`$find $tmp -size -257c -print`" in - X) cat $tmp > $FCODES;; + X) if [ "$FCODES" = "-" ]; then + cat $tmp + else + cat $tmp > $FCODES + fi;; *) echo "updatedb: locate database $tmp is empty" exit 1 esac |