#! /bin/sh

DPKGLIST=/var/lib/dlocate/dpkg-list

# See ionice(1)
if [ -x /usr/bin/ionice ]; then
    IONICE="/usr/bin/ionice -c3"
fi


# exit if dlocate is uninstalled but not purged
test -x /usr/sbin/update-dlocatedb || exit 0
# update dlocate database
$IONICE /usr/sbin/update-dlocatedb >/dev/null

# update 'dlocate -l' emulation
dpkg -l "*" | sed -e '1,5d' -e 's/  */ /g' >$DPKGLIST
