#! /bin/sh

if [ -x /usr/bin/slocate ] && [ ! -x /usr/bin/mlocate ]
then
	if [ -f /etc/updatedb.conf ]
	then
		. /etc/updatedb.conf
	fi

	# Adjust I/O priority of current process (default: best effort)
	ionice -c ${IONICE_CLASS:-2} -n ${IONICE_PRIORITY:-7} -p $$

	if [ -f /etc/updatedb.conf ]
	then
		nice -n ${NICE:-10} /usr/bin/slocate -u
	else
		nice -n ${NICE:-10} /usr/bin/slocate -u -f proc
	fi
	chown root.slocate /var/lib/slocate/slocate.db
fi
