Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/usr.bin/locate/locate Add support for specifying an alternat...
details: https://anonhg.NetBSD.org/src/rev/db269b6a8c92
branches: trunk
changeset: 969047:db269b6a8c92
user: simonb <simonb%NetBSD.org@localhost>
date: Thu Feb 06 08:45:44 2020 +0000
description:
Add support for specifying an alternate locate.updatedb config file.
diffstat:
usr.bin/locate/locate/locate.updatedb.8 | 18 +++++++++++++++-
usr.bin/locate/locate/updatedb.sh | 34 +++++++++++++++++++++++++++++---
2 files changed, 46 insertions(+), 6 deletions(-)
diffs (111 lines):
diff -r 71395165b462 -r db269b6a8c92 usr.bin/locate/locate/locate.updatedb.8
--- a/usr.bin/locate/locate/locate.updatedb.8 Thu Feb 06 06:28:49 2020 +0000
+++ b/usr.bin/locate/locate/locate.updatedb.8 Thu Feb 06 08:45:44 2020 +0000
@@ -1,4 +1,4 @@
-.\" $NetBSD: locate.updatedb.8,v 1.3 2008/09/22 13:10:25 hubertf Exp $
+.\" $NetBSD: locate.updatedb.8,v 1.4 2020/02/06 08:45:44 simonb Exp $
.\"
.\" Copyright (c) 1999-2008 The NetBSD Foundation, Inc.
.\" All rights reserved.
@@ -27,7 +27,7 @@
.\" ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
.\" POSSIBILITY OF SUCH DAMAGE.
.\"
-.Dd October 5, 2005
+.Dd February 6, 2020
.Dt LOCATE.UPDATEDB 8
.Os
.Sh NAME
@@ -35,6 +35,7 @@
.Nd update locate database
.Sh SYNOPSIS
.Nm /usr/libexec/locate.updatedb
+.Op Fl c Ar file
.Sh DESCRIPTION
The
.Nm
@@ -46,6 +47,19 @@
.Pp
The file systems and files (not) scanned can be configured in
.Xr locate.conf 5 .
+.Sh OPTIONS
+The
+.Nm
+program supports this option:
+.Bl -tag -width XcXfileXX
+.It Fl c Ar file
+Use
+.Ar file
+(in
+.Xr locate.conf 5
+format) as the configuration file instead of the default
+.Pa /etc/locate.conf .
+.El
.Sh FILES
.Bl -tag -width /usr/libexec/locate.updatedb -compact
.It Pa /var/db/locate.database
diff -r 71395165b462 -r db269b6a8c92 usr.bin/locate/locate/updatedb.sh
--- a/usr.bin/locate/locate/updatedb.sh Thu Feb 06 06:28:49 2020 +0000
+++ b/usr.bin/locate/locate/updatedb.sh Thu Feb 06 08:45:44 2020 +0000
@@ -1,6 +1,6 @@
#!/bin/sh
#
-# $NetBSD: updatedb.sh,v 1.15 2014/08/04 21:56:30 apb Exp $
+# $NetBSD: updatedb.sh,v 1.16 2020/02/06 08:45:44 simonb Exp $
#
# Copyright (c) 1989, 1993
# The Regents of the University of California. All rights reserved.
@@ -40,10 +40,9 @@
#
LIBDIR="/usr/libexec" # for subprograms
- # for temp files
-TMPDIR=/tmp
+TMPDIR="/tmp" # for temp files
FCODES="/var/db/locate.database" # the database
-CONF=/etc/locate.conf # configuration file
+CONF="/etc/locate.conf" # configuration file
PATH="/bin:/usr/bin"
@@ -97,6 +96,26 @@
printf "%s\n" "$result"
)}
+args=`getopt c: $*`
+if [ $? -ne 0 ]; then
+ progname=`basename $0`
+ echo 'Usage: ...'
+ echo "usage: ${progname} [-c config]"
+ exit 2
+fi
+set -- $args
+while [ $# -gt 0 ]; do
+ case "$1" in
+ -c)
+ CONF=$2; shift
+ ;;
+ --)
+ shift; break
+ ;;
+ esac
+ shift
+done
+
# read configuration file
if [ -f "$CONF" ]; then
while read -r com args; do
@@ -149,6 +168,13 @@
echo "$CONF: workdir: $1 nonexistent" >&2
fi
;;
+ database)
+ if [ $# -ne 1 ]; then
+ echo "$CONF: database takes exactly one argument" >&2
+ else
+ FCODES="$1"
+ fi
+ ;;
*)
echo "$CONF: $com: unknown config command" >&2
exit 1
Home |
Main Index |
Thread Index |
Old Index