r10656: BIG merge from trunk. Features not copied over
[Samba/nascimento.git] / source3 / script / installswat.sh
blobcba3a294f871a51cd586f8ecb7e78749126c26e1
1 #!/bin/sh
2 #first version March 1998, Andrew Tridgell
4 SWATDIR=`echo $1 | sed 's/\/\//\//g'`
5 SRCDIR=$2/
6 BOOKDIR=$SWATDIR/using_samba
8 echo Installing SWAT in $SWATDIR
9 echo Installing the Samba Web Administration Tool
11 LANGS=". `cd $SRCDIR../swat/; /bin/echo lang/??`"
12 echo Installing langs are `cd $SRCDIR../swat/lang/; /bin/echo ??`
14 for ln in $LANGS; do
15 SWATLANGDIR=$SWATDIR/$ln
16 for d in $SWATLANGDIR $SWATLANGDIR/help $SWATLANGDIR/images \
17 $SWATLANGDIR/include $SWATLANGDIR/js; 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
25 done
26 done
28 # Install images
29 for ln in $LANGS; do
31 for f in $SRCDIR../swat/$ln/images/*.png; do
32 if [ ! -f $f ] ; then
33 continue
35 FNAME=$SWATDIR/$ln/images/`basename $f`
36 echo $FNAME
37 cp $f $FNAME || echo Cannot install $FNAME. Does $USER have privileges?
38 chmod 0644 $FNAME
39 done
41 # Install html help
43 for f in $SRCDIR../swat/$ln/help/*.html; do
44 if [ ! -f $f ] ; then
45 continue
47 FNAME=$SWATDIR/$ln/help/`basename $f`
48 echo $FNAME
49 if [ "x$BOOKDIR" = "x" ]; then
50 cat $f | sed 's/@BOOKDIR@.*$//' > $f.tmp
51 else
52 cat $f | sed 's/@BOOKDIR@//' > $f.tmp
54 f=$f.tmp
55 cp $f $FNAME || echo Cannot install $FNAME. Does $USER have privileges?
56 rm -f $f
57 chmod 0644 $FNAME
58 done
60 # Install "server-side" includes
62 for f in $SRCDIR../swat/$ln/include/*; do
63 if [ ! -f $f ] ; then
64 continue
66 FNAME=$SWATDIR/$ln/include/`basename $f`
67 echo $FNAME
68 cp $f $FNAME || echo Cannot install $FNAME. Does $USER have privileges?
69 chmod 0644 $FNAME
70 done
72 # Install javascripts
74 for f in $SRCDIR../swat/$ln/js/*.js; do
75 if [ ! -f $f ] ; then
76 continue
78 FNAME=$SWATDIR/$ln/js/`basename $f`
79 echo $FNAME
80 cp $f $FNAME || echo Cannot install $FNAME. Does $USER have privileges?
81 chmod 0644 $FNAME
82 done
84 done
86 # Install html documentation (if html documentation tree is here)
88 if [ -d $SRCDIR../docs/htmldocs/ ]; then
90 for dir in htmldocs/ htmldocs/Samba-HOWTO-Collection htmldocs/Samba-Guide htmldocs/Samba-Developers-Guide
91 do
93 if [ ! -d $SRCDIR../docs/$dir ]; then
94 continue
97 INSTALLDIR=$SWATDIR/help/`echo $dir | sed 's/htmldocs\///g'`
98 if [ ! -d $INSTALLDIR ]; then
99 mkdir $INSTALLDIR
102 for f in $SRCDIR../docs/$dir/*.html; do
103 FNAME=$INSTALLDIR/`basename $f`
104 echo $FNAME
105 cp $f $FNAME || echo Cannot install $FNAME. Does $USER have privileges?
106 chmod 0644 $FNAME
107 done
109 if [ -d $SRCDIR../docs/$dir/images/ ]; then
110 if [ ! -d $INSTALLDIR/images/ ]; then
111 mkdir $INSTALLDIR/images
112 if [ ! -d $INSTALLDIR/images/ ]; then
113 echo Failed to make directory $SWATDIR/help/images, does $USER have privileges?
114 exit 1
117 for f in $SRCDIR../docs/$dir/images/*.png; do
118 FNAME=$INSTALLDIR/images/`basename $f`
119 echo $FNAME
120 cp $f $FNAME || echo Cannot install $FNAME. Does $USER have privileges?
121 chmod 0644 $FNAME
122 done
124 done
127 # Install Using Samba book (but only if it is there)
129 if [ "x$BOOKDIR" != "x" -a -f $SRCDIR../docs/htmldocs/using_samba/toc.html ]; then
131 # Create directories
133 for d in $BOOKDIR $BOOKDIR/figs ; do
134 if [ ! -d $d ]; then
135 mkdir $d
136 if [ ! -d $d ]; then
137 echo Failed to make directory $d, does $USER have privileges?
138 exit 1
141 done
143 # HTML files
145 for f in $SRCDIR../docs/htmldocs/using_samba/*.html; do
146 FNAME=$BOOKDIR/`basename $f`
147 echo $FNAME
148 cp $f $FNAME || echo Cannot install $FNAME. Does $USER have privileges?
149 chmod 0644 $FNAME
150 done
152 for f in $SRCDIR../docs/htmldocs/using_samba/*.gif; do
153 FNAME=$BOOKDIR/`basename $f`
154 echo $FNAME
155 cp $f $FNAME || echo Cannot install $FNAME. Does $USER have privileges?
156 chmod 0644 $FNAME
157 done
159 # Figures
161 for f in $SRCDIR../docs/htmldocs/using_samba/figs/*.gif; do
162 FNAME=$BOOKDIR/figs/`basename $f`
163 echo $FNAME
164 cp $f $FNAME || echo Cannot install $FNAME. Does $USER have privileges?
165 chmod 0644 $FNAME
166 done
170 cat << EOF
171 ======================================================================
172 The SWAT files have been installed. Remember to read the documentation
173 for information on enabling and using SWAT
174 ======================================================================
177 exit 0