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_catman_enable" in
15    [Yy][Ee][Ss])
16	if [ ! -d /usr/share/man/cat1 ]
17	then
18	    echo '$weekly_catman_enable is set but /usr/share/man/cat1' \
19		"doesn't exist"
20	    rc=2
21	else
22	    echo ""
23	    echo "Reformatting manual pages:"
24
25	    MANPATH=`/usr/bin/manpath -q`
26	    if [ $? = 0 ]
27	    then
28		if [ -z "${MANPATH}" ]
29		then
30		    echo "manpath failed to find any manpath directories"
31		    rc=3
32		else
33		    man_locales=`/usr/bin/manpath -qL`
34		    rc=0
35
36		    # Preformat original, non-localized manpages
37		    echo /usr/libexec/catman.local -r "$MANPATH" |
38			su -fm man || rc=3
39
40		    # Preformat localized manpages.
41		    if [ -n "$man_locales" ]
42		    then
43			for i in $man_locales
44			do
45			    echo /usr/libexec/catman.local -Lr \
46				"$MANPATH" | LC_ALL=$i su -fm man || rc=3
47			done
48		    fi
49		fi
50	    else
51		rc=3
52	    fi
53	fi;;
54
55    *)  rc=0;;
56esac
57
58exit $rc
59