#! /bin/sh ### ### Install library manual pages with many symlinks ### ### (c) 2003, 2013, 2016, 2020 Straylight/Edgeware ### ###----- Licensing notice --------------------------------------------------- ### ### This file is part of the Common Files Distribution (`common'). ### ### `Common' is free software; you can redistribute it and/or modify ### it under the terms of the GNU General Public License as published by ### the Free Software Foundation; either version 2 of the License, or ### (at your option) any later version. ### ### `Common' is distributed in the hope that it will be useful, ### but WITHOUT ANY WARRANTY; without even the implied warranty of ### MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the ### GNU General Public License for more details. ### ### You should have received a copy of the GNU General Public License ### along with `common'; if not, write to the Free Software Foundation, ### Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. set -e ext="" mandir=/usr/local/man srcdir=. inst=install mode=644 while [ $# -gt 0 ]; do case $1 in -h) echo "$0: [-e EXT] [-d DIR] [-i INSTALL] [-m MODE] [un]install FILE ..." exit 0 ;; -e) ext=$2; shift 2 ;; -d) mandir=$2; shift 2 ;; -i) inst=$2; shift 2 ;; -m) mode=$2; shift 2 ;; -s) srcdir=$2; shift 2 ;; --) shift; break ;; -*) echo >&2 "$0: unknown option \`$1'"; exit 1 ;; *) break ;; esac done op=$1; shift case $op in install | uninstall) ;; *) echo >&2 "$0: unknown operation \`$1'"; exit 1 ;; esac for i; do base=${i##*/} sec=${base##*.} case $op in install) echo -n " Installing manpage $base$ext" $inst -d "$mandir/man$sec" $inst -m $mode "$srcdir/$i" "$mandir/man$sec/$base$ext" ;; uninstall) rm -f "$mandir/man$sec/$base$ext" ;; esac for l in `sed 's:^\.\\\" *@::p; d' "$srcdir/$i"`; do case $op in install) if [ "$l.$sec" != "$base" ]; then echo -n "." echo ".so man$sec/$base$ext" >"$mandir/man$sec/$l.$sec$ext" chmod $mode "$mandir/man$sec/$l.$sec$ext" fi ;; uninstall) rm -f "$mandir/man$sec/$l.$sec$ext" ;; esac done case $op in install) echo ;; esac done