xref: /dragonfly/etc/periodic/weekly/320.whatis (revision 0db87cb7)
1#!/bin/sh -
2#
3# $FreeBSD: src/etc/periodic/weekly/320.whatis,v 1.5.2.3 2001/03/05 13:08:37 ru Exp $
4# $DragonFly: src/etc/periodic/weekly/320.whatis,v 1.2 2003/06/17 04:24:48 dillon Exp $
5#
6
7# If there is a global system configuration file, suck it in.
8#
9if [ -r /etc/defaults/periodic.conf ]
10then
11    . /etc/defaults/periodic.conf
12    source_periodic_confs
13fi
14
15case "$weekly_whatis_enable" in
16    [Yy][Ee][Ss])
17	echo ""
18	echo "Rebuilding whatis database:"
19
20	MANPATH=`/usr/bin/manpath -q`
21	if [ $? = 0 ]
22	then
23	    if [ -z "${MANPATH}" ]
24	    then
25		echo "manpath failed to find any manpage directories"
26		rc=3
27	    else
28		man_locales=`/usr/bin/manpath -qL`
29		rc=0
30
31	        # Build whatis(1) database(s) for original, non-localized
32		#  manpages.
33		/usr/libexec/makewhatis.local "${MANPATH}" || rc=3
34
35	        # Build whatis(1) database(s) for localized manpages.
36		if [ X"${man_locales}" != X ]
37		then
38		    for i in ${man_locales}
39		    do
40			LC_ALL=$i /usr/libexec/makewhatis.local -a \
41			    -L "${MANPATH}" || rc=3
42		    done
43		fi
44	    fi
45	else
46	    rc=3
47	fi;;
48
49    *)  rc=0;;
50esac
51
52exit $rc
53