r19758: remove the LDAP_SCOPE_ONELEVEL define (not needed after svnup)
[Samba.git] / source / script / installswat.sh
blobf4220b3c63223807ad4ca296c0d6c51bbb91aa4e
1 #!/bin/sh
2 #first version March 1998, Andrew Tridgell
4 DESTDIR=$1
5 SWATDIR=`echo $2 | sed 's/\/\//\//g'`
6 SRCDIR=$3/
7 BOOKDIR="$DESTDIR/$SWATDIR/using_samba"
9 case $0 in
10 *uninstall*)
11 echo "Removing SWAT from $DESTDIR/$SWATDIR "
12 echo "Removing the Samba Web Administration Tool "
13 echo -n "Removed "
14 mode='uninstall'
17 echo "Installing SWAT in $DESTDIR/$SWATDIR "
18 echo "Installing the Samba Web Administration Tool "
19 echo -n "Installing "
20 mode='install'
22 esac
24 LANGS=". `cd $SRCDIR../swat/; /bin/echo lang/??`"
25 echo "langs are `cd $SRCDIR../swat/lang/; /bin/echo ??` "
27 if test "$mode" = 'install'; then
28 for ln in $LANGS; do
29 SWATLANGDIR="$DESTDIR/$SWATDIR/$ln"
30 for d in $SWATLANGDIR $SWATLANGDIR/help $SWATLANGDIR/images \
31 $SWATLANGDIR/include $SWATLANGDIR/js; do
32 if [ ! -d $d ]; then
33 mkdir -p $d
34 if [ ! -d $d ]; then
35 echo "Failed to make directory $d, does $USER have privileges? "
36 exit 1
39 done
40 done
43 for ln in $LANGS; do
45 # images
46 for f in $SRCDIR../swat/$ln/images/*.gif; do
47 if [ ! -f $f ] ; then
48 continue
50 FNAME="$DESTDIR/$SWATDIR/$ln/images/`basename $f`"
51 echo $FNAME
52 if test "$mode" = 'install'; then
53 cp "$f" "$FNAME"
54 if test ! -f "$FNAME"; then
55 echo "Cannot install $FNAME. Does $USER have privileges? "
56 exit 1
58 chmod 0644 "$FNAME"
59 elif test "$mode" = 'uninstall'; then
60 rm -f "$FNAME"
61 if test -f "$FNAME"; then
62 echo "Cannot remove $FNAME. Does $USER have privileges? "
63 exit 1
65 else
66 echo "Unknown mode, $mode. Script called as $0 "
67 exit 1
69 done
71 # html help
72 for f in $SRCDIR../swat/$ln/help/*.html; do
73 if [ ! -f $f ] ; then
74 continue
76 FNAME="$DESTDIR/$SWATDIR/$ln/help/`basename $f`"
77 echo $FNAME
78 if test "$mode" = 'install'; then
79 if [ "x$BOOKDIR" = "x" ]; then
80 cat $f | sed 's/@BOOKDIR@.*$//' > $f.tmp
81 else
82 cat $f | sed 's/@BOOKDIR@//' > $f.tmp
84 f=$f.tmp
85 cp "$f" "$FNAME"
86 rm -f "$f"
87 if test ! -f "$FNAME"; then
88 echo "Cannot install $FNAME. Does $USER have privileges? "
89 exit 1
91 chmod 0644 "$FNAME"
92 elif test "$mode" = 'uninstall'; then
93 rm -f "$FNAME"
94 if test -f "$FNAME"; then
95 echo "Cannot remove $FNAME. Does $USER have privileges? "
96 exit 1
99 done
101 # "server-side" includes
102 for f in $SRCDIR../swat/$ln/include/*; do
103 if [ ! -f $f ] ; then
104 continue
106 FNAME="$DESTDIR/$SWATDIR/$ln/include/`basename $f`"
107 echo $FNAME
108 if test "$mode" = 'install'; then
109 cp "$f" "$FNAME"
110 if test ! -f "$FNAME"; then
111 echo "Cannot install $FNAME. Does $USER have privileges? "
112 exit 1
114 chmod 0644 $FNAME
115 elif test "$mode" = 'uninstall'; then
116 rm -f "$FNAME"
117 if test -f "$FNAME"; then
118 echo "Cannot remove $FNAME. Does $USER have privileges? "
119 exit 1
122 done
124 done
126 # Install/ remove html documentation (if html documentation tree is here)
128 if [ -d $SRCDIR../docs/htmldocs/ ]; then
130 for dir in htmldocs/manpages htmldocs/Samba3-ByExample htmldocs/Samba3-Developers-Guide htmldocs/Samba3-HOWTO
133 if [ ! -d $SRCDIR../docs/$dir ]; then
134 continue
137 INSTALLDIR="$DESTDIR/$SWATDIR/help/`echo $dir | sed 's/htmldocs\///g'`"
138 if test ! -d "$INSTALLDIR" -a "$mode" = 'install'; then
139 mkdir "$INSTALLDIR"
140 if test ! -d "$INSTALLDIR"; then
141 echo "Failed to make directory $INSTALLDIR, does $USER have privileges? "
142 exit 1
146 for f in $SRCDIR../docs/$dir/*.html; do
147 FNAME=$INSTALLDIR/`basename $f`
148 echo $FNAME
149 if test "$mode" = 'install'; then
150 cp "$f" "$FNAME"
151 if test ! -f "$FNAME"; then
152 echo "Cannot install $FNAME. Does $USER have privileges? "
153 exit 1
155 chmod 0644 $FNAME
156 elif test "$mode" = 'uninstall'; then
157 rm -f "$FNAME"
158 if test -f "$FNAME"; then
159 echo "Cannot remove $FNAME. Does $USER have privileges? "
160 exit 1
163 done
165 if test -d "$SRCDIR../docs/$dir/images/"; then
166 if test ! -d "$INSTALLDIR/images/" -a "$mode" = 'install'; then
167 mkdir "$INSTALLDIR/images"
168 if test ! -d "$INSTALLDIR/images/"; then
169 echo "Failed to make directory $INSTALLDIR/images, does $USER have privileges? "
170 exit 1
173 for f in $SRCDIR../docs/$dir/images/*.png; do
174 FNAME=$INSTALLDIR/images/`basename $f`
175 echo $FNAME
176 if test "$mode" = 'install'; then
177 cp "$f" "$FNAME"
178 if test ! -f "$FNAME"; then
179 echo "Cannot install $FNAME. Does $USER have privileges? "
180 exit 1
182 chmod 0644 $FNAME
183 elif test "$mode" = 'uninstall'; then
184 rm -f "$FNAME"
185 if test -f "$FNAME"; then
186 echo "Cannot remove $FNAME. Does $USER have privileges? "
187 exit 1
190 done
192 done
195 # Install/ remove Using Samba book (but only if it is there)
197 if [ "x$BOOKDIR" != "x" -a -f $SRCDIR../docs/htmldocs/using_samba/toc.html ]; then
199 # Create directories
201 for d in $BOOKDIR $BOOKDIR/figs ; do
202 if test ! -d "$d" -a "$mode" = 'install'; then
203 mkdir $d
204 if test ! -d "$d"; then
205 echo "Failed to make directory $d, does $USER have privileges? "
206 exit 1
209 done
211 # HTML files
213 for f in $SRCDIR../docs/htmldocs/using_samba/*.html; do
214 FNAME=$BOOKDIR/`basename $f`
215 echo $FNAME
216 if test "$mode" = 'install'; then
217 cp "$f" "$FNAME"
218 if test ! -f "$FNAME"; then
219 echo "Cannot install $FNAME. Does $USER have privileges? "
220 exit 1
222 chmod 0644 $FNAME
223 elif test "$mode" = 'uninstall'; then
224 rm -f "$FNAME"
225 if test -f "$FNAME"; then
226 echo "Cannot remove $FNAME. Does $USER have privileges? "
227 exit 1
230 done
232 for f in $SRCDIR../docs/htmldocs/using_samba/*.gif; do
233 FNAME=$BOOKDIR/`basename $f`
234 echo $FNAME
235 if test "$mode" = 'install'; then
236 cp "$f" "$FNAME"
237 if test ! -f "$FNAME"; then
238 echo "Cannot install $FNAME. Does $USER have privileges? "
239 exit 1
241 chmod 0644 $FNAME
242 elif test "$mode" = 'uninstall'; then
243 rm -f "$FNAME"
244 if test -f "$FNAME"; then
245 echo "Cannot remove $FNAME. Does $USER have privileges? "
246 exit 1
249 done
251 # Figures
253 for f in $SRCDIR../docs/htmldocs/using_samba/figs/*.gif; do
254 FNAME=$BOOKDIR/figs/`basename $f`
255 echo $FNAME
256 if test "$mode" = 'install'; then
257 cp "$f" "$FNAME"
258 if test ! -f "$FNAME"; then
259 echo "Cannot install $FNAME. Does $USER have privileges? "
260 exit 1
262 chmod 0644 $FNAME
263 elif test "$mode" = 'uninstall'; then
264 rm -f "$FNAME"
265 if test -f "$FNAME"; then
266 echo "Cannot remove $FNAME. Does $USER have privileges? "
267 exit 1
270 done
274 if test "$mode" = 'install'; then
275 cat << EOF
276 ======================================================================
277 The SWAT files have been installed. Remember to read the documentation
278 for information on enabling and using SWAT
279 ======================================================================
281 else
282 cat << EOF
283 ======================================================================
284 The SWAT files have been removed. You may restore these files using
285 the command "make installswat" or "make install" to install binaries,
286 man pages, modules, SWAT, and shell scripts.
287 ======================================================================
291 exit 0