#!/bin/sh
#
#
# do_mandb. This script was split off cron.daily.
# Please add your local changes to cron.daily.local
# since this file will be overwritten, when updating your system.
#
# Copyright (c) 1996-2002 SuSE GmbH Nuernberg, Germany.   
#
# please send bugfixes or comments to feedback@suse.de.
#
# Author: Burchard Steinbild <feedback@suse.de>, 1996
#         Florian La Roche <feedback@suse.de>, 1996
#

#
# paranoia settings
#
umask 022

PATH=/sbin:/bin:/usr/sbin:/usr/bin
export PATH

#
# get information from /etc/sysconfig/cron
#
if test -f /etc/sysconfig/cron ; then
    . /etc/sysconfig/cron
fi


#
# now we do the man page stuff
#
if test "$REINIT_MANDB" = yes -o ! -s /var/cache/man/index.db ; then
    if test -x /usr/bin/mandb ; then
	test -x /usr/bin/safe-rm -a -e /var/cache/man/index.bt && \
	    /usr/bin/safe-rm /var/cache/man/index.bt
	/usr/bin/mandb -q -s 2> /dev/null || {
	    echo There seem to be trouble with mandb.
	    echo
	    echo please run /usr/bin/mandb an check the output...
	}
    fi
    #
    # some applications need whatis database. If makewhatis exists, call it
    #
    if test -x /usr/sbin/makewhatis ; then
	/usr/sbin/makewhatis
    fi
fi

exit 0
