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