This commit was manufactured by cvs2svn to create branch 'SAMBA_3_0'.(This used to...
[ira/wip.git] / source3 / script / installswat.sh
1 #!/bin/sh
2 #first version March 1998, Andrew Tridgell
3
4 SWATDIR=`echo $1 | sed 's/\/\//\//g'`
5 SRCDIR=$2/
6 BOOKDIR=$SWATDIR/using_samba
7
8 echo Installing SWAT in $SWATDIR
9 echo Installing the Samba Web Administration Tool
10
11 LANGS=". `cd $SRCDIR../swat/; /bin/echo lang/??`"
12 echo Installing langs are `cd $SRCDIR../swat/lang/; /bin/echo ??`
13
14 for ln in $LANGS; do 
15  SWATLANGDIR=$SWATDIR/$ln
16  for d in $SWATLANGDIR $SWATLANGDIR/help $SWATLANGDIR/images \
17         $SWATLANGDIR/include; do
18     if [ ! -d $d ]; then
19         mkdir -p $d
20         if [ ! -d $d ]; then
21             echo Failed to make directory $d, does $USER have privileges?
22             exit 1
23         fi
24     fi
25  done
26 done
27
28 # Install images
29 for ln in $LANGS; do
30
31   for f in $SRCDIR../swat/$ln/images/*.gif; do
32       FNAME=$SWATDIR/$ln/images/`basename $f`
33       echo $FNAME
34       cp $f $FNAME || echo Cannot install $FNAME. Does $USER have privileges?
35       chmod 0644 $FNAME
36   done
37
38   # Install html help
39
40   for f in $SRCDIR../swat/$ln/help/*.html; do
41       FNAME=$SWATDIR/$ln/help/`basename $f`
42       echo $FNAME
43       if [ "x$BOOKDIR" = "x" ]; then
44         cat $f | sed 's/@BOOKDIR@.*$//' > $f.tmp
45       else
46         cat $f | sed 's/@BOOKDIR@//' > $f.tmp
47       fi
48       f=$f.tmp
49       cp $f $FNAME || echo Cannot install $FNAME. Does $USER have privileges?
50       rm -f $f
51       chmod 0644 $FNAME
52   done
53
54   # Install "server-side" includes
55
56   for f in $SRCDIR../swat/$ln/include/*.html; do
57       FNAME=$SWATDIR/$ln/include/`basename $f`
58       echo $FNAME
59       cp $f $FNAME || echo Cannot install $FNAME. Does $USER have privileges?
60       chmod 0644 $FNAME
61   done
62
63 done
64
65 # Install html documentation (if html documentation tree is here)
66
67 if [ -d $SRCDIR../docs/htmldocs/ ]; then
68
69     for f in $SRCDIR../docs/htmldocs/*.html; do
70         FNAME=$SWATDIR/help/`basename $f`
71         echo $FNAME
72         cp $f $FNAME || echo Cannot install $FNAME. Does $USER have privileges?
73         chmod 0644 $FNAME
74     done
75 fi
76
77 # Install Using Samba book (but only if it is there)
78
79 if [ "x$BOOKDIR" != "x" -a -f $SRCDIR../docs/htmldocs/using_samba/toc.html ]; then
80
81     # Create directories
82
83     for d in $BOOKDIR $BOOKDIR/figs ; do
84         if [ ! -d $d ]; then
85             mkdir $d
86             if [ ! -d $d ]; then
87                 echo Failed to make directory $d, does $USER have privileges?
88                 exit 1
89             fi
90         fi
91     done
92
93     # HTML files
94
95     for f in $SRCDIR../docs/htmldocs/using_samba/*.html; do
96         FNAME=$BOOKDIR/`basename $f`
97         echo $FNAME
98         cp $f $FNAME || echo Cannot install $FNAME. Does $USER have privileges?
99         chmod 0644 $FNAME
100     done
101
102     for f in $SRCDIR../docs/htmldocs/using_samba/*.gif; do
103         FNAME=$BOOKDIR/`basename $f`
104         echo $FNAME
105         cp $f $FNAME || echo Cannot install $FNAME. Does $USER have privileges?
106         chmod 0644 $FNAME
107     done
108
109     # Figures
110
111     for f in $SRCDIR../docs/htmldocs/using_samba/figs/*.gif; do
112         FNAME=$BOOKDIR/figs/`basename $f`
113         echo $FNAME
114         cp $f $FNAME || echo Cannot install $FNAME. Does $USER have privileges?
115         chmod 0644 $FNAME
116     done
117
118 fi
119
120 cat << EOF
121 ======================================================================
122 The SWAT files have been installed. Remember to read the swat/README
123 for information on enabling and using SWAT
124 ======================================================================
125 EOF
126
127 exit 0
128