r10656: BIG merge from trunk. Features not copied over
[Samba/nascimento.git] / source3 / script / installman.sh
blob5564ac02318e276d4d52ae0450c4f18537673028
1 #!/bin/sh
2 #5 July 96 Dan.Shearer@unisa.edu.au removed hardcoded values
4 # 13 Aug 2001 Rafal Szczesniak <mimir@spin.ict.pwr.wroc.pl>
5 # modified to accomodate international man pages (inspired
6 # by Japanese edition's approach)
8 MANDIR=`echo $1 | sed 's/\/\//\//g'`
9 SRCDIR=$2/
10 langs=$3
12 if [ $# -ge 4 ] ; then
13 GROFF=$4 # sh cmd line, including options
16 if test ! -d docs/manpages; then
17 echo "No manpages present. SVN development version maybe?"
18 exit 0
21 for lang in $langs; do
22 if [ "X$lang" = XC ]; then
23 echo Installing default man pages in $MANDIR/
24 lang=.
25 else
26 echo Installing \"$lang\" man pages in $MANDIR/lang/$lang
29 langdir=$MANDIR/$lang
30 for d in $MANDIR $langdir $langdir/man1 $langdir/man5 $langdir/man7 $langdir/man8; do
31 if [ ! -d $d ]; then
32 mkdir $d
33 if [ ! -d $d ]; then
34 echo Failed to make directory $d, does $USER have privileges?
35 exit 1
38 done
40 for sect in 1 5 7 8 ; do
41 for m in $langdir/man$sect ; do
42 for s in $SRCDIR../docs/manpages/$lang/*$sect; do
43 FNAME=$m/`basename $s`
45 # Test for writability. Involves
46 # blowing away existing files.
48 if (rm -f $FNAME && touch $FNAME); then
49 rm $FNAME
50 if [ "x$GROFF" = x ] ; then
51 cp $s $m # Copy raw nroff
52 else
53 echo "\t$FNAME" # groff'ing can be slow, give the user
54 # a warm fuzzy.
55 $GROFF $s > $FNAME # Process nroff, because man(1) (on
56 # this system) doesn't .
58 chmod 0644 $FNAME
59 else
60 echo Cannot create $FNAME... does $USER have privileges?
62 done
63 done
64 done
65 done
66 cat << EOF
67 ======================================================================
68 The man pages have been installed. You may uninstall them using the command
69 the command "make uninstallman" or make "uninstall" to uninstall binaries,
70 man pages and shell scripts.
71 ======================================================================
72 EOF
74 exit 0