svn commit: r214583 - head/usr.bin/locate/locate
Garrett Wollman
wollman at FreeBSD.org
Sun Oct 31 02:36:06 UTC 2010
Author: wollman
Date: Sun Oct 31 02:36:05 2010
New Revision: 214583
URL: http://svn.freebsd.org/changeset/base/214583
Log:
Make it possible to exclude directories by name no matter where they
are in the filesystem from the locate database. By default, exclude
".zfs" directories, as users who who have set snapdir=visible and are
taking frequent snapshots most likely do not want the snapshots
included in the locate database.
Modified:
head/usr.bin/locate/locate/locate.rc
head/usr.bin/locate/locate/updatedb.sh
Modified: head/usr.bin/locate/locate/locate.rc
==============================================================================
--- head/usr.bin/locate/locate/locate.rc Sun Oct 31 02:15:23 2010 (r214582)
+++ head/usr.bin/locate/locate/locate.rc Sun Oct 31 02:36:05 2010 (r214583)
@@ -15,9 +15,12 @@
# directories to be put in the database
#SEARCHPATHS="/"
-# directories unwanted in output
+# paths unwanted in output
#PRUNEPATHS="/tmp /usr/tmp /var/tmp /var/db/portsnap"
+# directories unwanted in output
+#PRUNEDIRS=".zfs"
+
# filesystems allowed. Beware: a non-listed filesystem will be pruned
# and if the SEARCHPATHS starts in such a filesystem locate will build
# an empty database.
Modified: head/usr.bin/locate/locate/updatedb.sh
==============================================================================
--- head/usr.bin/locate/locate/updatedb.sh Sun Oct 31 02:15:23 2010 (r214582)
+++ head/usr.bin/locate/locate/updatedb.sh Sun Oct 31 02:36:05 2010 (r214583)
@@ -52,6 +52,7 @@ PATH=$LIBEXECDIR:/bin:/usr/bin:$PATH; ex
: ${FCODES:=/var/db/locate.database} # the database
: ${SEARCHPATHS:="/"} # directories to be put in the database
: ${PRUNEPATHS:="/tmp /usr/tmp /var/tmp /var/db/portsnap"} # unwanted directories
+: ${PRUNEDIRS:=".zfs"} # unwanted directories, in any parent
: ${FILESYSTEMS:="$(lsvfs | tail -n +3 | \
egrep -vw "loopback|network|synthetic|read-only|0" | \
cut -d " " -f1)"} # allowed filesystems
@@ -79,6 +80,14 @@ case X"$PRUNEPATHS" in
done;;
esac
+case X"$PRUNEDIRS" in
+ X) ;;
+ *) for dir in $PRUNEDIRS
+ do
+ excludes="$excludes -or -name $dir -type d -prune"
+ done;;
+esac
+
tmp=$TMPDIR/_updatedb$$
trap 'rm -f $tmp; rmdir $TMPDIR' 0 1 2 3 5 10 15
More information about the svn-src-head
mailing list