xref: /freebsd/libexec/makewhatis.local/makewhatis.local.sh (revision d0b2dbfa0ecf2bbc9709efc5e20baf8e4b44bbbf)
124e9c818SBryan Drewery#!/bin/sh
224e9c818SBryan Drewery#
324e9c818SBryan Drewery# Copyright (c) April 1996 Wolfram Schneider <wosch@FreeBSD.org>. Berlin.
424e9c818SBryan Drewery# All rights reserved.
524e9c818SBryan Drewery#
624e9c818SBryan Drewery# Redistribution and use in source and binary forms, with or without
724e9c818SBryan Drewery# modification, are permitted provided that the following conditions
824e9c818SBryan Drewery# are met:
924e9c818SBryan Drewery# 1. Redistributions of source code must retain the above copyright
1024e9c818SBryan Drewery#    notice, this list of conditions and the following disclaimer.
1124e9c818SBryan Drewery# 2. Redistributions in binary form must reproduce the above copyright
1224e9c818SBryan Drewery#    notice, this list of conditions and the following disclaimer in the
1324e9c818SBryan Drewery#    documentation and/or other materials provided with the distribution.
1424e9c818SBryan Drewery#
1524e9c818SBryan Drewery# THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND
1624e9c818SBryan Drewery# ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
1724e9c818SBryan Drewery# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
1824e9c818SBryan Drewery# ARE DISCLAIMED.  IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE
1924e9c818SBryan Drewery# FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
2024e9c818SBryan Drewery# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
2124e9c818SBryan Drewery# OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
2224e9c818SBryan Drewery# HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
2324e9c818SBryan Drewery# LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
2424e9c818SBryan Drewery# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
2524e9c818SBryan Drewery# SUCH DAMAGE.
2624e9c818SBryan Drewery#
2724e9c818SBryan Drewery# makewhatis.local - start makewhatis(1) only for file systems
2824e9c818SBryan Drewery#		     physically mounted on the system
2924e9c818SBryan Drewery#
3024e9c818SBryan Drewery# Running makewhatis from /etc/periodic/weekly/320.whatis for rw nfs-mounted
3124e9c818SBryan Drewery# /usr may kill your NFS server -- all clients start makewhatis at the same
3224e9c818SBryan Drewery# time! So use this wrapper instead calling makewhatis directly.
3324e9c818SBryan Drewery#
3424e9c818SBryan Drewery
3524e9c818SBryan DreweryPATH=/bin:/usr/bin:$PATH; export PATH
3624e9c818SBryan Dreweryopt= dirs= localdirs=
3724e9c818SBryan Drewery
3824e9c818SBryan Dreweryfor arg
3924e9c818SBryan Drewerydo
4024e9c818SBryan Drewery	case "$arg" in
4124e9c818SBryan Drewery		-*) 	opt="$opt $arg";;
4224e9c818SBryan Drewery		*)	dirs="$dirs $arg";;
4324e9c818SBryan Drewery	esac
4424e9c818SBryan Drewerydone
4524e9c818SBryan Drewery
4624e9c818SBryan Drewerydirs=`echo $dirs | sed 's/:/ /g'`
4724e9c818SBryan Drewerycase X"$dirs" in X) echo "usage: $0 [options] directories ..."; exit 1;; esac
4824e9c818SBryan Drewery
49*4a36780bSEugene Grosbeinlocaldirs=`find -H $dirs -fstype local \! -fstype rdonly -type d -prune -print`
5024e9c818SBryan Drewery
5124e9c818SBryan Drewerycase X"$localdirs" in
52*4a36780bSEugene Grosbein	X) 	echo "$0: no local rw-mounted manual directories found: $dirs"
5324e9c818SBryan Drewery		exit 1;;
5424e9c818SBryan Drewery	*) 	exec `basename $0 .local` $opt $localdirs;;
5524e9c818SBryan Dreweryesac
56