#!/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 .local files over /etc/daily and /etc/weekly is that the
# next system update won't discard your changes.
#
if [ -x __PREFIX__/bin/slocate ]; then
    echo ""
    echo "Rebuilding slocate database:"
    if [ -f __PREFIX__/etc/updatedb.conf ]; then
		# One day, I'll look at the bug that requires doing cd / when launched
		# with periodic.
		(cd / && __PREFIX__/bin/slocate -u -c __PREFIX__/etc/updatedb.conf)
	else
		(cd / && __PREFIX__/bin/slocate -u)
	fi
fi
