3 # $Id: install-catman.sh 20232 2007-02-16 11:03:13Z lha $
5 # install preformatted manual pages
8 INSTALL_DATA="$1"; shift
9 mkinstalldirs="$1"; shift
13 catinstall="${INSTALL_CATPAGES-yes}"
16 base=`echo "$f" | sed 's/\(.*\)\.\([^.]*\)$/\1/'`
17 section=`echo "$f" | sed 's/\(.*\)\.\([^.]*\)$/\2/'`
18 mandir="$manbase/man$section"
19 catdir="$manbase/cat$section"
22 if test "$catinstall" = yes -a -f "$srcdir/$c"; then
23 if test "$cmd" = install ; then
24 if test \! -d "$catdir"; then
25 eval "$mkinstalldirs $catdir"
27 eval "echo $INSTALL_DATA $srcdir/$c $catdir/$base.$suffix"
28 eval "$INSTALL_DATA $srcdir/$c $catdir/$base.$suffix"
29 elif test "$cmd" = uninstall ; then
30 eval "echo rm -f $catdir/$base.$suffix"
31 eval "rm -f $catdir/$base.$suffix"
34 for link in `sed -n -e '/SYNOPSIS/q;/DESCRIPTION/q;s/^\.Nm \([^ ]*\).*/\1/p' $srcdir/$f`; do
35 if test "$link" = "$base" ; then
38 if test "$cmd" = install ; then
39 target="$mandir/$link.$section"
40 for lncmd in "ln -f $mandir/$base.$section $target" \
41 "ln -s $base.$section $target" \
42 "cp -f $mandir/$base.$section $target"
44 if eval "$lncmd"; then
49 if test "$catinstall" = yes -a -f "$srcdir/$c"; then
50 target="$catdir/$link.$suffix"
51 for lncmd in "ln -f $catdir/$base.$suffix $target" \
52 "ln -fs $base.$suffix $target" \
53 "cp -f $catdir/$base.$suffix $target"
55 if eval "$lncmd"; then
61 elif test "$cmd" = uninstall ; then
62 target="$mandir/$link.$section"
63 eval "echo rm -f $target"
65 if test "$catinstall" = yes; then
66 target="$catdir/$link.$suffix"
67 eval "echo rm -f $target"