Submit Hint Search The Forums LinksStatsPollsHeadlinesRSS
14,000 hints and counting!


Click here to return to the 'Prevent locate's update from updating certain folders' hint
The following comments are owned by whoever posted them. This site is not responsible for what they say.
Prevent locate's update from updating certain folders
Authored by: bluehz on Jul 12, '04 01:51:35AM

The GNU locate and also slocate (which is now the standard in the Linux world) both offer pruning options for defining items to not scan into the db. I recommend slocate - which is a secure version of locate allowing users to only search for files they have permissions to access. Installing slocate is a bit beyond the scope of this hint and really requires its own thread so I will post to the site and maybe it will show up in a few days as a hint.

The GNU version of locate only seems to come as part of the findutils source code - this includes find, xargs, and locate. You can install the complete pkg through Fink:

fink install findutils

or use the following script to install it manually if you don't have Fink - optionally only installing the locate/updatedb components. You will still need the Developer tools installed to compile the source code.

#!/bin/sh

mkdir ~/Desktop/findutils-build
cd findutils-build

# downloads source files
curl -O ftp://alpha.gnu.org/gnu/findutils/findutils-4.1.20.tar.gz
curl "http://cvs.sourceforge.net/viewcvs.py/*checkout*/fink/dists/10.3/stable/main/finkinfo/utils/findutils.patch" -o findutils.patch
tar -zxvf findutils-4.1.20.tar.gz

# patch source files
patch -p1 -b -d findutils-4.1.20 < findutils.patch
cd findutils-4.1.20
sed 's/@PREFIX@/usr\/local/g' findutils.cron > findutils.cron.tmp
mv findutils.cron.tmp findutils.cron
chmod 755 findutils.cron

# build and install
./configure CFLAGS=-DHAVE_F_FSTYPENAME_IN_STATFS
make
sudo make install-strip

# If you only want to install locate and updatedb
# comment out the above "make install" line
# and uncomment the following lines
#
# mkdir build 
# sudo make install-strip DESTDIR=$cwd/build 
# sudo cp -p build/usr/local/man/man1/updatedb.1 /usr/local/man/man1 
# sudo cp -p build/usr/local/man/man1/locate.1 /usr/local/man/man1 
# sudo cp -p build/usr/local/man/man5/locatedb.5 /usr/local/man/man5 
# sudo cp -p build/usr/local/bin/locate /usr/local/bin 
# sudo cp -p build/usr/local/bin/updatedb /usr/local/bin 

# install crontab and updatedb.conf
sudo cp -p findutil.cron /etc/periodic/daily
sudo echo > /etc/updatedb.conf <<EOF "# /etc/updatedb.conf:  updatedb configuration file

PRUNEPATHS=\"/tmp /usr/tmp /var/tmp /afs /net\""
EOF

echo "Information at http://www.gnu.org/software/findutils/manual/html_chapter/find_7.html#SEC73"


[ Reply to This | # ]
Prevent locate's update from updating certain folders
Authored by: bluehz on Jul 12, '04 02:09:57AM

Ooops - forget about the part "optionally installing only locate/updatedb". I just realized that the complete findutils pkg is required for updatedb to work properly



[ Reply to This | # ]