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