#!/bin/sh -

# daily.slocate
#
# These are actually lines to put in /etc/daily.local (create it if it doesn't
# exist) to update the slocate database daily. You can also put the lines in
# /etc/weekly.local if you want to update the database only weekly.
# The advantage of .daily files over /etc/daily and /etc/weekly files is that
# next system update won't discard your changes.
#
if [ -x /opt/local/bin/slocate ]; then
    echo ""
    echo "Rebuilding slocate database:"
    if [ -f /opt/local/etc/updatedb.conf ]; then
		# One day, I'll look at the bug that requires doing cd / when launched
		# with periodic.
		(cd / && /opt/local/bin/slocate -u -c)
	else
		(cd / && /opt/local/bin/slocate -u)
	fi
fi
