#!/bin/sh -e 
#
# Copyright 2001,2002 by Stefan Hornburg (Racke) <racke@linuxia.de>
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public
# License along with this program; if not, write to the Free
# Software Foundation, Inc., 59 Temple Place, Suite 330, Boston,
# MA  02111-1307  USA.

# create /var/lib/dhelp if necessary
if [ ! -d /var/lib/dhelp ]; then
    mkdir /var/lib/dhelp
fi

# remove /usr/doc/HTML2 if upgrading from old dhelp package
if [ "$1" = configure -a -d /usr/doc/HTML2 ]; then
    rm -rf /usr/doc/HTML2
fi

# remove old /var/lib/dhelp/swish++.index (versions older than 0.6)
rm -f /var/lib/dhelp/swish++.index

# hack to be able to tell if the package is configured, so 3rd party packages
# that call dhelp don't barf (from scrollkeeper package)
touch /var/lib/dhelp/configured

echo -n "Building HTML tree..."
dhelp_parse -r
echo " done."

if [ ! -f /var/lib/dhelp/documents.index ]; then
    echo "Reindexing documentation in the background"
    /etc/cron.weekly/dhelp 2>/dev/null >/dev/null &
fi

#DEBHELPER#
