2001-02-11 16:51:06 +03:00
|
|
|
#!/bin/sh
|
|
|
|
#
|
2008-03-22 11:36:48 +03:00
|
|
|
# $Heimdal: install-catman.sh 20232 2007-02-16 11:03:13Z lha $
|
|
|
|
# $NetBSD: install-catman.sh,v 1.4 2008/03/22 08:36:58 mlelstv Exp $
|
2001-02-11 16:51:06 +03:00
|
|
|
#
|
|
|
|
# install preformatted manual pages
|
|
|
|
|
2008-03-22 11:36:48 +03:00
|
|
|
cmd="$1"; shift
|
2001-02-11 16:51:06 +03:00
|
|
|
INSTALL_DATA="$1"; shift
|
|
|
|
mkinstalldirs="$1"; shift
|
|
|
|
srcdir="$1"; shift
|
2001-09-17 16:24:30 +04:00
|
|
|
manbase="$1"; shift
|
2001-02-11 16:51:06 +03:00
|
|
|
suffix="$1"; shift
|
2008-03-22 11:36:48 +03:00
|
|
|
catinstall="${INSTALL_CATPAGES-yes}"
|
2001-02-11 16:51:06 +03:00
|
|
|
|
|
|
|
for f in "$@"; do
|
|
|
|
base=`echo "$f" | sed 's/\(.*\)\.\([^.]*\)$/\1/'`
|
|
|
|
section=`echo "$f" | sed 's/\(.*\)\.\([^.]*\)$/\2/'`
|
2001-09-17 16:24:30 +04:00
|
|
|
mandir="$manbase/man$section"
|
|
|
|
catdir="$manbase/cat$section"
|
2001-02-11 16:51:06 +03:00
|
|
|
c="$base.cat$section"
|
2001-09-17 16:24:30 +04:00
|
|
|
|
2008-03-22 11:36:48 +03:00
|
|
|
if test "$catinstall" = yes -a -f "$srcdir/$c"; then
|
|
|
|
if test "$cmd" = install ; then
|
|
|
|
if test \! -d "$catdir"; then
|
|
|
|
eval "$mkinstalldirs $catdir"
|
|
|
|
fi
|
|
|
|
eval "echo $INSTALL_DATA $srcdir/$c $catdir/$base.$suffix"
|
|
|
|
eval "$INSTALL_DATA $srcdir/$c $catdir/$base.$suffix"
|
|
|
|
elif test "$cmd" = uninstall ; then
|
|
|
|
eval "echo rm -f $catdir/$base.$suffix"
|
|
|
|
eval "rm -f $catdir/$base.$suffix"
|
2001-02-11 16:51:06 +03:00
|
|
|
fi
|
|
|
|
fi
|
2002-09-12 17:18:49 +04:00
|
|
|
for link in `sed -n -e '/SYNOPSIS/q;/DESCRIPTION/q;s/^\.Nm \([^ ]*\).*/\1/p' $srcdir/$f`; do
|
2008-03-22 11:36:48 +03:00
|
|
|
if test "$link" = "$base" ; then
|
|
|
|
continue
|
|
|
|
fi
|
|
|
|
if test "$cmd" = install ; then
|
2001-09-17 16:24:30 +04:00
|
|
|
target="$mandir/$link.$section"
|
2008-03-22 11:36:48 +03:00
|
|
|
for lncmd in "ln -f $mandir/$base.$section $target" \
|
2001-09-17 16:24:30 +04:00
|
|
|
"ln -s $base.$section $target" \
|
|
|
|
"cp -f $mandir/$base.$section $target"
|
|
|
|
do
|
2008-03-22 11:36:48 +03:00
|
|
|
if eval "$lncmd"; then
|
|
|
|
eval echo "$lncmd"
|
2001-09-17 16:24:30 +04:00
|
|
|
break
|
|
|
|
fi
|
|
|
|
done
|
2008-03-22 11:36:48 +03:00
|
|
|
if test "$catinstall" = yes -a -f "$srcdir/$c"; then
|
2001-09-17 16:24:30 +04:00
|
|
|
target="$catdir/$link.$suffix"
|
2008-03-22 11:36:48 +03:00
|
|
|
for lncmd in "ln -f $catdir/$base.$suffix $target" \
|
2001-09-17 16:24:30 +04:00
|
|
|
"ln -fs $base.$suffix $target" \
|
|
|
|
"cp -f $catdir/$base.$suffix $target"
|
|
|
|
do
|
2008-03-22 11:36:48 +03:00
|
|
|
if eval "$lncmd"; then
|
|
|
|
eval echo "$lncmd"
|
2001-09-17 16:24:30 +04:00
|
|
|
break
|
|
|
|
fi
|
|
|
|
done
|
|
|
|
fi
|
2008-03-22 11:36:48 +03:00
|
|
|
elif test "$cmd" = uninstall ; then
|
|
|
|
target="$mandir/$link.$section"
|
|
|
|
eval "echo rm -f $target"
|
|
|
|
eval "rm -f $target"
|
|
|
|
if test "$catinstall" = yes; then
|
|
|
|
target="$catdir/$link.$suffix"
|
|
|
|
eval "echo rm -f $target"
|
|
|
|
eval "rm -f $target"
|
|
|
|
fi
|
2001-09-17 16:24:30 +04:00
|
|
|
fi
|
|
|
|
done
|
2001-02-11 16:51:06 +03:00
|
|
|
done
|