summaryrefslogtreecommitdiff
path: root/usr.bin/locate
diff options
context:
space:
mode:
authorlukem <lukem@NetBSD.org>2004-04-19 01:05:22 +0000
committerlukem <lukem@NetBSD.org>2004-04-19 01:05:22 +0000
commit1efa87943c62065aaad65dc6d5cabdada6298eff (patch)
tree130478a7a07ef2e701dd6bfe23e4bd7b8f500baa /usr.bin/locate
parent1df7609f719e74b71ecf9b128a1f63ce53589abb (diff)
Rework "ignorefs" behaviour:
* types are added to (rather than overriding) the default list * Still use "ignorefs none" to clear the list (including the default list) * Fix argument parsing when using "none" This makes "ignorefs" much more useful if you just want to add another fstype to the default list. Simplify variable assignment.
Diffstat (limited to 'usr.bin/locate')
-rw-r--r--usr.bin/locate/locate/updatedb.sh30
1 files changed, 6 insertions, 24 deletions
diff --git a/usr.bin/locate/locate/updatedb.sh b/usr.bin/locate/locate/updatedb.sh
index 62ca750047e..daaafeecfdd 100644
--- a/usr.bin/locate/locate/updatedb.sh
+++ b/usr.bin/locate/locate/updatedb.sh
@@ -1,6 +1,6 @@
#!/bin/sh
#
-# $NetBSD: updatedb.sh,v 1.8 2004/02/06 14:29:51 itohy Exp $
+# $NetBSD: updatedb.sh,v 1.9 2004/04/19 01:05:22 lukem Exp $
#
# Copyright (c) 1989, 1993
# The Regents of the University of California. All rights reserved.
@@ -47,8 +47,7 @@ CONF=/etc/locate.conf # configuration file
PATH="/bin:/usr/bin"
-ignorefs_default='! -fstype local -o -fstype cd9660 -o -fstype fdesc -o -fstype kernfs -o -fstype procfs'
-ignorefs=unset
+ignorefs='! -fstype local -o -fstype cd9660 -o -fstype fdesc -o -fstype kernfs -o -fstype procfs'
ignore=
SRCHPATHS=
@@ -63,34 +62,22 @@ if [ -f "$CONF" ]; then
SRCHPATHS="$SRCHPATHS $args";;
ignorefs)
for i in $args; do
- case "$args" in
+ case "$i" in
none) ignorefs=;;
*) fs=`echo "$i" | sed -e 's/^!/! -fstype /' -e t -e 's/^/-fstype /'`
- case "$ignorefs" in
- ''|unset)
- ignorefs="$fs";;
- *) ignorefs="$ignorefs -o $fs";;
- esac;;
+ ignorefs="${ignorefs:+${ignorefs} -o }${fs}"
esac
done;;
ignore)
set -f
for i in $args; do
- case "$ignore" in
- '') ;;
- *) ignore="$ignore -o";;
- esac
- ignore="$ignore -path $i"
+ ignore="${ignore:+${ignore} -o }-path ${i}"
done
set +f;;
ignorecontents)
set -f
for i in $args; do
- case "$ignore" in
- '') ;;
- *) ignore="$ignore -o";;
- esac
- ignore="$ignore -path $i -print"
+ ignore="${ignore:+${ignore} -o }-path ${i} -print"
done
set +f;;
workdir)
@@ -107,11 +94,6 @@ if [ -f "$CONF" ]; then
exec <&5 5>&-
fi
-# default value when "ignorefs" is absent
-case "$ignorefs" in
-unset) ignorefs=$ignorefs_default;;
-esac
-
: ${SRCHPATHS:=/} # directories to be put in the database
export TMPDIR