#! /bin/bash

set -e

if [ 1 = 1 ]; then
	SBINDIR=/usr/bin
	LOCATEGROUP=locate
else
	SBINDIR=/usr/local/sbin
	LOCATEGROUP=mlocate
fi

$SBINDIR/plocate-build /var/lib/mlocate/mlocate.db /var/lib/mlocate/plocate.db.new
chgrp $LOCATEGROUP /var/lib/mlocate/plocate.db.new
mv /var/lib/mlocate/plocate.db.new /var/lib/mlocate/plocate.db
