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