Makefile.in configure configure.in include/config.h.in: Changes for DGUX and UNIXWARE.
[kai/samba.git] / source / script / installman.sh
1 #!/bin/sh
2 #5 July 96 Dan.Shearer@unisa.edu.au  removed hardcoded values
3
4 MANDIR=$1
5 SRCDIR=$2/
6 if [ $# -ge 3 ] ; then
7   GROFF=$3                    # sh cmd line, including options 
8 fi
9
10 echo Installing man pages in $MANDIR
11
12 for d in $MANDIR $MANDIR/man1 $MANDIR/man5 $MANDIR/man7 $MANDIR/man8; do
13 if [ ! -d $d ]; then
14 mkdir $d
15 if [ ! -d $d ]; then
16   echo Failed to make directory $d, does $USER have privileges?
17   exit 1
18 fi
19 fi
20 done
21
22 for sect in 1 5 7 8 ; do
23   for m in $MANDIR/man$sect ; do
24     for s in $SRCDIR../docs/manpages/*$sect; do
25       FNAME=$m/`basename $s`
26  
27        # Test for writability.  Involves 
28        # blowing away existing files.
29  
30        if (rm -f $FNAME && touch $FNAME); then
31          rm $FNAME
32          if [ ! "$GROFF" ] ; then
33            cp $s $m              # Copy raw nroff 
34          else
35            echo "\t$FNAME"       # groff'ing can be slow, give the user
36                                  #   a warm fuzzy.
37            $GROFF $s > $FNAME    # Process nroff, because man(1) (on
38                                  #   this system) doesn't .
39          fi
40          chmod 0644 $FNAME
41        else
42          echo Cannot create $FNAME... does $USER have privileges?
43        fi
44     done
45   done
46 done
47
48 cat << EOF
49 ======================================================================
50 The man pages have been installed. You may uninstall them using the command
51 the command "make uninstallman" or make "uninstall" to uninstall binaries,
52 man pages and shell scripts.
53 ======================================================================
54 EOF
55
56 exit 0
57