Try to handle ticket full and ticketless tickets better.
[heimdal.git] / cf / install-catman.sh
blobade0eebe905431feed2c18e1c0953b0ed0291765
1 #!/bin/sh
3 # $Id$
5 # install preformatted manual pages
7 cmd="$1"; shift
8 INSTALL_DATA="$1"; shift
9 mkinstalldirs="$1"; shift
10 srcdir="$1"; shift
11 manbase="$1"; shift
12 suffix="$1"; shift
13 catinstall="${INSTALL_CATPAGES-yes}"
15 for f in "$@"; do
16 base=`echo "$f" | sed 's/\(.*\)\.\([^.]*\)$/\1/'`
17 section=`echo "$f" | sed 's/\(.*\)\.\([^.]*\)$/\2/'`
18 mandir="$manbase/man$section"
19 catdir="$manbase/cat$section"
20 c="$base.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
36 continue
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
45 eval echo "$lncmd"
46 break
48 done
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
56 eval echo "$lncmd"
57 break
59 done
61 elif test "$cmd" = uninstall ; then
62 target="$mandir/$link.$section"
63 eval "echo rm -f $target"
64 eval "rm -f $target"
65 if test "$catinstall" = yes; then
66 target="$catdir/$link.$suffix"
67 eval "echo rm -f $target"
68 eval "rm -f $target"
71 done
72 done