source: branches/samba-3.3.x/source/script/installswat.sh@ 472

Last change on this file since 472 was 206, checked in by Herwig Bauernfeind, 16 years ago

Import Samba 3.3 branch at 3.0.0 level (psmedley's port)

File size: 8.3 KB
Line 
1#!/bin/sh
2#first version March 1998, Andrew Tridgell
3
4DESTDIR=$1
5SWATDIR=`echo $2 | sed 's/\/\//\//g'`
6SRCDIR=$3/
7BOOKDIR="$DESTDIR/$SWATDIR/using_samba"
8
9case $0 in
10 *uninstall*)
11 echo "Removing SWAT from $DESTDIR/$SWATDIR "
12 echo "Removing the Samba Web Administration Tool "
13 printf "%s" "Removed "
14 mode='uninstall'
15 ;;
16 *)
17 echo "Installing SWAT in $DESTDIR/$SWATDIR "
18 echo "Installing the Samba Web Administration Tool "
19 printf "%s" "Installing "
20 mode='install'
21 ;;
22esac
23
24LANGS=". `cd $SRCDIR../swat/; /bin/echo lang/??`"
25echo "langs are `cd $SRCDIR../swat/lang/; /bin/echo ??` "
26
27if 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
37 fi
38 fi
39 done
40 done
41fi
42
43for ln in $LANGS; do
44
45 # images
46 for f in $SRCDIR../swat/$ln/images/*.gif; do
47 if [ ! -f $f ] ; then
48 continue
49 fi
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
57 fi
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
64 fi
65 else
66 echo "Unknown mode, $mode. Script called as $0 "
67 exit 1
68 fi
69 done
70
71 # html help
72 for f in $SRCDIR../swat/$ln/help/*.html; do
73 if [ ! -f $f ] ; then
74 continue
75 fi
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@.*$//' > $FNAME.tmp
81 else
82 cat $f | sed 's/@BOOKDIR@//' > $FNAME.tmp
83 fi
84 if test ! -f "$FNAME.tmp"; then
85 echo "Cannot install $FNAME. Does $USER have privileges? "
86 exit 1
87 fi
88 f=$FNAME.tmp
89 cp "$f" "$FNAME"
90 rm -f "$f"
91 if test ! -f "$FNAME"; then
92 echo "Cannot install $FNAME. Does $USER have privileges? "
93 exit 1
94 fi
95 chmod 0644 "$FNAME"
96 elif test "$mode" = 'uninstall'; then
97 rm -f "$FNAME"
98 if test -f "$FNAME"; then
99 echo "Cannot remove $FNAME. Does $USER have privileges? "
100 exit 1
101 fi
102 fi
103 done
104
105 # "server-side" includes
106 for f in $SRCDIR../swat/$ln/include/*; do
107 if [ ! -f $f ] ; then
108 continue
109 fi
110 FNAME="$DESTDIR/$SWATDIR/$ln/include/`basename $f`"
111 echo $FNAME
112 if test "$mode" = 'install'; then
113 cp "$f" "$FNAME"
114 if test ! -f "$FNAME"; then
115 echo "Cannot install $FNAME. Does $USER have privileges? "
116 exit 1
117 fi
118 chmod 0644 $FNAME
119 elif test "$mode" = 'uninstall'; then
120 rm -f "$FNAME"
121 if test -f "$FNAME"; then
122 echo "Cannot remove $FNAME. Does $USER have privileges? "
123 exit 1
124 fi
125 fi
126 done
127
128done
129
130# Install/ remove html documentation (if html documentation tree is here)
131
132if [ -d $SRCDIR../docs/htmldocs/ ]; then
133
134 for dir in htmldocs/manpages htmldocs/Samba3-ByExample htmldocs/Samba3-Developers-Guide htmldocs/Samba3-HOWTO
135 do
136
137 if [ ! -d $SRCDIR../docs/$dir ]; then
138 continue
139 fi
140
141 INSTALLDIR="$DESTDIR/$SWATDIR/help/`echo $dir | sed 's/htmldocs\///g'`"
142 if test ! -d "$INSTALLDIR" -a "$mode" = 'install'; then
143 mkdir "$INSTALLDIR"
144 if test ! -d "$INSTALLDIR"; then
145 echo "Failed to make directory $INSTALLDIR, does $USER have privileges? "
146 exit 1
147 fi
148 fi
149
150 for f in $SRCDIR../docs/$dir/*.html; do
151 FNAME=$INSTALLDIR/`basename $f`
152 echo $FNAME
153 if test "$mode" = 'install'; then
154 cp "$f" "$FNAME"
155 if test ! -f "$FNAME"; then
156 echo "Cannot install $FNAME. Does $USER have privileges? "
157 exit 1
158 fi
159 chmod 0644 $FNAME
160 elif test "$mode" = 'uninstall'; then
161 rm -f "$FNAME"
162 if test -f "$FNAME"; then
163 echo "Cannot remove $FNAME. Does $USER have privileges? "
164 exit 1
165 fi
166 fi
167 done
168
169 if test -d "$SRCDIR../docs/$dir/images/"; then
170 if test ! -d "$INSTALLDIR/images/" -a "$mode" = 'install'; then
171 mkdir "$INSTALLDIR/images"
172 if test ! -d "$INSTALLDIR/images/"; then
173 echo "Failed to make directory $INSTALLDIR/images, does $USER have privileges? "
174 exit 1
175 fi
176 fi
177 for f in $SRCDIR../docs/$dir/images/*.png; do
178 FNAME=$INSTALLDIR/images/`basename $f`
179 echo $FNAME
180 if test "$mode" = 'install'; then
181 cp "$f" "$FNAME"
182 if test ! -f "$FNAME"; then
183 echo "Cannot install $FNAME. Does $USER have privileges? "
184 exit 1
185 fi
186 chmod 0644 $FNAME
187 elif test "$mode" = 'uninstall'; then
188 rm -f "$FNAME"
189 if test -f "$FNAME"; then
190 echo "Cannot remove $FNAME. Does $USER have privileges? "
191 exit 1
192 fi
193 fi
194 done
195 fi
196 done
197fi
198
199# Install/ remove Using Samba book (but only if it is there)
200
201if [ "x$BOOKDIR" != "x" -a -f $SRCDIR../docs/htmldocs/using_samba/toc.html ]; then
202
203 # Create directories
204
205 for d in $BOOKDIR $BOOKDIR/figs ; do
206 if test ! -d "$d" -a "$mode" = 'install'; then
207 mkdir $d
208 if test ! -d "$d"; then
209 echo "Failed to make directory $d, does $USER have privileges? "
210 exit 1
211 fi
212 fi
213 done
214
215 # HTML files
216
217 for f in $SRCDIR../docs/htmldocs/using_samba/*.html; do
218 FNAME=$BOOKDIR/`basename $f`
219 echo $FNAME
220 if test "$mode" = 'install'; then
221 cp "$f" "$FNAME"
222 if test ! -f "$FNAME"; then
223 echo "Cannot install $FNAME. Does $USER have privileges? "
224 exit 1
225 fi
226 chmod 0644 $FNAME
227 elif test "$mode" = 'uninstall'; then
228 rm -f "$FNAME"
229 if test -f "$FNAME"; then
230 echo "Cannot remove $FNAME. Does $USER have privileges? "
231 exit 1
232 fi
233 fi
234 done
235
236 for f in $SRCDIR../docs/htmldocs/using_samba/*.gif; do
237 FNAME=$BOOKDIR/`basename $f`
238 echo $FNAME
239 if test "$mode" = 'install'; then
240 cp "$f" "$FNAME"
241 if test ! -f "$FNAME"; then
242 echo "Cannot install $FNAME. Does $USER have privileges? "
243 exit 1
244 fi
245 chmod 0644 $FNAME
246 elif test "$mode" = 'uninstall'; then
247 rm -f "$FNAME"
248 if test -f "$FNAME"; then
249 echo "Cannot remove $FNAME. Does $USER have privileges? "
250 exit 1
251 fi
252 fi
253 done
254
255 # Figures
256
257 for f in $SRCDIR../docs/htmldocs/using_samba/figs/*.gif; do
258 FNAME=$BOOKDIR/figs/`basename $f`
259 echo $FNAME
260 if test "$mode" = 'install'; then
261 cp "$f" "$FNAME"
262 if test ! -f "$FNAME"; then
263 echo "Cannot install $FNAME. Does $USER have privileges? "
264 exit 1
265 fi
266 chmod 0644 $FNAME
267 elif test "$mode" = 'uninstall'; then
268 rm -f "$FNAME"
269 if test -f "$FNAME"; then
270 echo "Cannot remove $FNAME. Does $USER have privileges? "
271 exit 1
272 fi
273 fi
274 done
275
276fi
277
278if test "$mode" = 'install'; then
279 cat << EOF
280======================================================================
281The SWAT files have been installed. Remember to read the documentation
282for information on enabling and using SWAT
283======================================================================
284EOF
285else
286 cat << EOF
287======================================================================
288The SWAT files have been removed. You may restore these files using
289the command "make installswat" or "make install" to install binaries,
290man pages, modules, SWAT, and shell scripts.
291======================================================================
292EOF
293fi
294
295exit 0
296
Note: See TracBrowser for help on using the repository browser.