10SN/A#!/bin/sh -
23233Sksrini#
30SN/A# $FreeBSD: releng/10.2/etc/periodic/weekly/330.catman 208060 2010-05-14 04:53:57Z dougb $
40SN/A#
50SN/A
60SN/A# If there is a global system configuration file, suck it in.
7553SN/A#
80SN/Aif [ -r /etc/defaults/periodic.conf ]
9553SN/Athen
100SN/A    . /etc/defaults/periodic.conf
110SN/A    source_periodic_confs
120SN/Afi
130SN/A
140SN/Acase "$weekly_catman_enable" in
150SN/A    [Yy][Ee][Ss])
160SN/A	if [ ! -d /usr/share/man/cat1 ]
170SN/A	then
180SN/A	    echo '$weekly_catman_enable is set but /usr/share/man/cat1' \
190SN/A		"doesn't exist"
200SN/A	    rc=2
21553SN/A	else
22553SN/A	    echo ""
23553SN/A	    echo "Reformatting manual pages:"
240SN/A
250SN/A	    MANPATH=`/usr/bin/manpath -q`
263233Sksrini	    if [ $? = 0 ]
270SN/A	    then
28765SN/A		if [ -z "${MANPATH}" ]
291356SN/A		then
303233Sksrini		    echo "manpath failed to find any manpath directories"
313233Sksrini		    rc=3
323233Sksrini		else
333233Sksrini		    man_locales=`/usr/bin/manpath -qL`
343233Sksrini		    rc=0
353233Sksrini
363233Sksrini		    # Preformat original, non-localized manpages
373233Sksrini		    echo /usr/libexec/catman.local -r "$MANPATH" |
383233Sksrini			su -fm man || rc=3
393233Sksrini
403233Sksrini		    # Preformat localized manpages.
413233Sksrini		    if [ -n "$man_locales" ]
423233Sksrini		    then
433606Sjjg			for i in $man_locales
443233Sksrini			do
453233Sksrini			    echo /usr/libexec/catman.local -Lr \
463233Sksrini				"$MANPATH" | LC_ALL=$i su -fm man || rc=3
470SN/A			done
480SN/A		    fi
490SN/A		fi
500SN/A	    else
511358SN/A		rc=3
521358SN/A	    fi
531358SN/A	fi;;
541358SN/A
551358SN/A    *)  rc=0;;
560SN/Aesac
57242SN/A
580SN/Aexit $rc
593233Sksrini