s3:winbind: Convert WINBINDD_REMOVE_MAPPING to the new API
[Samba/fernandojvsilva.git] / source3 / script / installswat.sh
blob40596f3bd87bf6192fa65b26d943710abed5a48e
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 printf "%s" "Removed "
14 mode='uninstall'
17 echo "Installing SWAT in $DESTDIR/$SWATDIR "
18 echo "Installing the Samba Web Administration Tool "
19 printf "%s" "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@.*$//' > $FNAME.tmp
81 else
82 cat $f | sed 's/@BOOKDIR@//' > $FNAME.tmp
84 if test ! -f "$FNAME.tmp"; then
85 echo "Cannot install $FNAME. Does $USER have privileges? "
86 exit 1
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
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
103 done
105 # "server-side" includes
106 for f in $SRCDIR../swat/$ln/include/*; do
107 if [ ! -f $f ] ; then
108 continue
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
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
126 done
128 done
130 # Install/ remove html documentation (if html documentation tree is here)
132 if [ -d $SRCDIR../docs/htmldocs/ ]; then
134 for dir in htmldocs/manpages htmldocs/Samba3-ByExample htmldocs/Samba3-Developers-Guide htmldocs/Samba3-HOWTO
137 if [ ! -d $SRCDIR../docs/$dir ]; then
138 continue
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
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
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
167 done
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
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
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
194 done
196 done
199 # Install/ remove Using Samba book (but only if it is there)
201 if [ "x$BOOKDIR" != "x" -a -f $SRCDIR../docs/htmldocs/using_samba/toc.html ]; then
203 # Create directories
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
213 done
215 # HTML files
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
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
234 done
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
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
253 done
255 # Figures
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
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
274 done
278 if test "$mode" = 'install'; then
279 cat << EOF
280 ======================================================================
281 The SWAT files have been installed. Remember to read the documentation
282 for information on enabling and using SWAT
283 ======================================================================
285 else
286 cat << EOF
287 ======================================================================
288 The SWAT files have been removed. You may restore these files using
289 the command "make installswat" or "make install" to install binaries,
290 man pages, modules, SWAT, and shell scripts.
291 ======================================================================
295 exit 0