1998-03-12 06:12:30 +03:00
#!/bin/sh
2003-04-21 05:04:17 +04:00
#first version March 1998, Andrew Tridgell
1998-03-12 06:12:30 +03:00
2006-02-24 03:30:09 +03:00
DESTDIR = $1
SWATDIR = ` echo $2 | sed 's/\/\//\//g' `
SRCDIR = $3 /
BOOKDIR = " $DESTDIR / $SWATDIR /using_samba "
1998-07-29 07:08:05 +04:00
2006-02-24 03:30:09 +03:00
case $0 in
*uninstall*)
echo " Removing SWAT from $DESTDIR / $SWATDIR "
echo "Removing the Samba Web Administration Tool "
2008-04-01 17:53:54 +04:00
printf "%s" "Removed "
2006-02-24 03:30:09 +03:00
mode = 'uninstall'
; ;
*)
echo " Installing SWAT in $DESTDIR / $SWATDIR "
echo "Installing the Samba Web Administration Tool "
2008-04-01 17:53:54 +04:00
printf "%s" "Installing "
2006-02-24 03:30:09 +03:00
mode = 'install'
; ;
esac
1998-03-12 06:12:30 +03:00
2001-10-15 09:15:31 +04:00
LANGS = " . `cd $SRCDIR ../swat/; /bin/echo lang/??` "
2006-02-24 03:30:09 +03:00
echo " langs are `cd $SRCDIR ../swat/lang/; /bin/echo ??` "
2001-09-25 21:40:12 +04:00
2006-02-24 03:30:09 +03:00
if test " $mode " = 'install' ; then
for ln in $LANGS ; do
SWATLANGDIR = " $DESTDIR / $SWATDIR / $ln "
for d in $SWATLANGDIR $SWATLANGDIR /help $SWATLANGDIR /images \
$SWATLANGDIR /include $SWATLANGDIR /js; do
if [ ! -d $d ] ; then
mkdir -p $d
2001-01-13 00:47:01 +03:00
if [ ! -d $d ] ; then
2006-02-24 03:30:09 +03:00
echo " Failed to make directory $d , does $USER have privileges? "
exit 1
2001-01-13 00:47:01 +03:00
fi
2006-02-24 03:30:09 +03:00
fi
done
2001-10-15 09:15:31 +04:00
done
2006-02-24 03:30:09 +03:00
fi
2001-09-25 21:40:12 +04:00
for ln in $LANGS ; do
2001-01-13 00:47:01 +03:00
2006-02-24 03:30:09 +03:00
# images
2006-05-06 01:37:13 +04:00
for f in $SRCDIR ../swat/$ln /images/*.gif; do
2006-02-24 03:30:09 +03:00
if [ ! -f $f ] ; then
continue
fi
FNAME = " $DESTDIR / $SWATDIR / $ln /images/`basename $f ` "
echo $FNAME
if test " $mode " = 'install' ; then
cp " $f " " $FNAME "
2006-03-03 20:00:56 +03:00
if test ! -f " $FNAME " ; then
2006-02-24 03:30:09 +03:00
echo " Cannot install $FNAME . Does $USER have privileges? "
exit 1
2003-12-10 17:10:26 +03:00
fi
2006-02-24 03:30:09 +03:00
chmod 0644 " $FNAME "
elif test " $mode " = 'uninstall' ; then
rm -f " $FNAME "
2006-03-03 20:00:56 +03:00
if test -f " $FNAME " ; then
2006-02-24 03:30:09 +03:00
echo " Cannot remove $FNAME . Does $USER have privileges? "
exit 1
fi
else
echo " Unknown mode, $mode . Script called as $0 "
exit 1
fi
2003-11-08 02:04:06 +03:00
done
1998-03-12 06:12:30 +03:00
2006-02-24 03:30:09 +03:00
# html help
2003-11-08 02:04:06 +03:00
for f in $SRCDIR ../swat/$ln /help/*.html; do
2006-02-24 03:30:09 +03:00
if [ ! -f $f ] ; then
continue
fi
FNAME = " $DESTDIR / $SWATDIR / $ln /help/`basename $f ` "
echo $FNAME
if test " $mode " = 'install' ; then
2001-01-13 00:47:01 +03:00
if [ " x $BOOKDIR " = "x" ] ; then
2007-01-05 02:25:04 +03:00
cat $f | sed 's/@BOOKDIR@.*$//' > $FNAME .tmp
2001-01-13 00:47:01 +03:00
else
2007-01-05 02:25:04 +03:00
cat $f | sed 's/@BOOKDIR@//' > $FNAME .tmp
2001-01-13 00:47:01 +03:00
fi
2007-01-05 02:25:04 +03:00
if test ! -f " $FNAME .tmp " ; then
echo " Cannot install $FNAME . Does $USER have privileges? "
exit 1
fi
f = $FNAME .tmp
2006-02-24 03:30:09 +03:00
cp " $f " " $FNAME "
rm -f " $f "
2006-03-03 20:00:56 +03:00
if test ! -f " $FNAME " ; then
2006-02-24 03:30:09 +03:00
echo " Cannot install $FNAME . Does $USER have privileges? "
exit 1
fi
chmod 0644 " $FNAME "
elif test " $mode " = 'uninstall' ; then
rm -f " $FNAME "
2006-03-03 20:00:56 +03:00
if test -f " $FNAME " ; then
2006-02-24 03:30:09 +03:00
echo " Cannot remove $FNAME . Does $USER have privileges? "
exit 1
fi
fi
2003-11-08 02:04:06 +03:00
done
1998-03-12 06:12:30 +03:00
2006-02-24 03:30:09 +03:00
# "server-side" includes
2006-02-04 01:19:41 +03:00
for f in $SRCDIR ../swat/$ln /include/*; do
2003-12-10 17:10:26 +03:00
if [ ! -f $f ] ; then
continue
fi
2006-02-24 03:30:09 +03:00
FNAME = " $DESTDIR / $SWATDIR / $ln /include/`basename $f ` "
1998-11-27 09:09:03 +03:00
echo $FNAME
2006-02-24 03:30:09 +03:00
if test " $mode " = 'install' ; then
cp " $f " " $FNAME "
2006-03-03 20:00:56 +03:00
if test ! -f " $FNAME " ; then
2006-02-24 03:30:09 +03:00
echo " Cannot install $FNAME . Does $USER have privileges? "
exit 1
fi
chmod 0644 $FNAME
elif test " $mode " = 'uninstall' ; then
rm -f " $FNAME "
2006-03-03 20:00:56 +03:00
if test -f " $FNAME " ; then
2006-02-24 03:30:09 +03:00
echo " Cannot remove $FNAME . Does $USER have privileges? "
exit 1
fi
fi
2003-11-08 02:04:06 +03:00
done
1998-11-27 09:09:03 +03:00
done
2006-02-24 03:30:09 +03:00
# Install/ remove html documentation (if html documentation tree is here)
2001-01-13 00:47:01 +03:00
2003-11-12 16:02:25 +03:00
if [ -d $SRCDIR ../docs/htmldocs/ ] ; then
2005-10-18 21:20:50 +04:00
for dir in htmldocs/manpages htmldocs/Samba3-ByExample htmldocs/Samba3-Developers-Guide htmldocs/Samba3-HOWTO
2004-05-05 19:52:11 +04:00
do
if [ ! -d $SRCDIR ../docs/$dir ] ; then
continue
fi
2006-02-24 03:30:09 +03:00
INSTALLDIR = " $DESTDIR / $SWATDIR /help/`echo $dir | sed 's/htmldocs\///g'` "
if test ! -d " $INSTALLDIR " -a " $mode " = 'install' ; then
mkdir " $INSTALLDIR "
if test ! -d " $INSTALLDIR " ; then
echo " Failed to make directory $INSTALLDIR , does $USER have privileges? "
exit 1
fi
2004-05-05 19:52:11 +04:00
fi
2004-03-02 21:10:12 +03:00
2004-05-05 19:52:11 +04:00
for f in $SRCDIR ../docs/$dir /*.html; do
FNAME = $INSTALLDIR /` basename $f `
echo $FNAME
2006-02-24 03:30:09 +03:00
if test " $mode " = 'install' ; then
cp " $f " " $FNAME "
2006-03-03 20:00:56 +03:00
if test ! -f " $FNAME " ; then
2006-02-24 03:30:09 +03:00
echo " Cannot install $FNAME . Does $USER have privileges? "
exit 1
fi
chmod 0644 $FNAME
elif test " $mode " = 'uninstall' ; then
rm -f " $FNAME "
2006-03-03 20:00:56 +03:00
if test -f " $FNAME " ; then
2006-02-24 03:30:09 +03:00
echo " Cannot remove $FNAME . Does $USER have privileges? "
exit 1
fi
fi
2004-05-05 19:52:11 +04:00
done
2006-02-24 03:30:09 +03:00
if test -d " $SRCDIR ../docs/ $dir /images/ " ; then
if test ! -d " $INSTALLDIR /images/ " -a " $mode " = 'install' ; then
mkdir " $INSTALLDIR /images "
if test ! -d " $INSTALLDIR /images/ " ; then
echo " Failed to make directory $INSTALLDIR /images, does $USER have privileges? "
2004-05-05 19:52:11 +04:00
exit 1
fi
fi
for f in $SRCDIR ../docs/$dir /images/*.png; do
2004-11-23 18:27:53 +03:00
FNAME = $INSTALLDIR /images/` basename $f `
2004-05-05 19:52:11 +04:00
echo $FNAME
2006-02-24 03:30:09 +03:00
if test " $mode " = 'install' ; then
cp " $f " " $FNAME "
2006-03-03 20:00:56 +03:00
if test ! -f " $FNAME " ; then
2006-02-24 03:30:09 +03:00
echo " Cannot install $FNAME . Does $USER have privileges? "
exit 1
fi
chmod 0644 $FNAME
elif test " $mode " = 'uninstall' ; then
rm -f " $FNAME "
2006-03-03 20:00:56 +03:00
if test -f " $FNAME " ; then
2006-02-24 03:30:09 +03:00
echo " Cannot remove $FNAME . Does $USER have privileges? "
exit 1
fi
fi
2004-05-05 19:52:11 +04:00
done
fi
done
2003-11-12 16:02:25 +03:00
fi
1998-09-01 10:03:52 +04:00
2006-02-24 03:30:09 +03:00
# Install/ remove Using Samba book (but only if it is there)
2001-01-13 00:47:01 +03:00
2003-08-22 20:23:56 +04:00
if [ " x $BOOKDIR " != "x" -a -f $SRCDIR ../docs/htmldocs/using_samba/toc.html ] ; then
2001-01-13 00:47:01 +03:00
# Create directories
2003-08-22 20:23:56 +04:00
for d in $BOOKDIR $BOOKDIR /figs ; do
2006-02-24 03:30:09 +03:00
if test ! -d " $d " -a " $mode " = 'install' ; then
2001-01-13 00:47:01 +03:00
mkdir $d
2006-02-24 03:30:09 +03:00
if test ! -d " $d " ; then
echo " Failed to make directory $d , does $USER have privileges? "
2001-01-13 00:47:01 +03:00
exit 1
fi
fi
done
# HTML files
for f in $SRCDIR ../docs/htmldocs/using_samba/*.html; do
FNAME = $BOOKDIR /` basename $f `
echo $FNAME
2006-02-24 03:30:09 +03:00
if test " $mode " = 'install' ; then
cp " $f " " $FNAME "
2006-03-03 20:00:56 +03:00
if test ! -f " $FNAME " ; then
2006-02-24 03:30:09 +03:00
echo " Cannot install $FNAME . Does $USER have privileges? "
exit 1
fi
chmod 0644 $FNAME
elif test " $mode " = 'uninstall' ; then
rm -f " $FNAME "
2006-03-03 20:00:56 +03:00
if test -f " $FNAME " ; then
2006-02-24 03:30:09 +03:00
echo " Cannot remove $FNAME . Does $USER have privileges? "
exit 1
fi
fi
2001-01-13 00:47:01 +03:00
done
2003-08-29 01:23:04 +04:00
for f in $SRCDIR ../docs/htmldocs/using_samba/*.gif; do
FNAME = $BOOKDIR /` basename $f `
echo $FNAME
2006-02-24 03:30:09 +03:00
if test " $mode " = 'install' ; then
cp " $f " " $FNAME "
2006-03-03 20:00:56 +03:00
if test ! -f " $FNAME " ; then
2006-02-24 03:30:09 +03:00
echo " Cannot install $FNAME . Does $USER have privileges? "
exit 1
fi
chmod 0644 $FNAME
elif test " $mode " = 'uninstall' ; then
rm -f " $FNAME "
2006-03-03 20:00:56 +03:00
if test -f " $FNAME " ; then
2006-02-24 03:30:09 +03:00
echo " Cannot remove $FNAME . Does $USER have privileges? "
exit 1
fi
fi
2003-08-29 01:23:04 +04:00
done
2001-01-13 00:47:01 +03:00
# Figures
for f in $SRCDIR ../docs/htmldocs/using_samba/figs/*.gif; do
FNAME = $BOOKDIR /figs/` basename $f `
echo $FNAME
2006-02-24 03:30:09 +03:00
if test " $mode " = 'install' ; then
cp " $f " " $FNAME "
2006-03-03 20:00:56 +03:00
if test ! -f " $FNAME " ; then
2006-02-24 03:30:09 +03:00
echo " Cannot install $FNAME . Does $USER have privileges? "
exit 1
fi
chmod 0644 $FNAME
elif test " $mode " = 'uninstall' ; then
rm -f " $FNAME "
2006-03-03 20:00:56 +03:00
if test -f " $FNAME " ; then
2006-02-24 03:30:09 +03:00
echo " Cannot remove $FNAME . Does $USER have privileges? "
exit 1
fi
fi
2001-01-13 00:47:01 +03:00
done
fi
2006-02-24 03:30:09 +03:00
if test " $mode " = 'install' ; then
cat << EOF
1998-03-12 06:12:30 +03:00
= = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = =
2005-06-21 01:20:47 +04:00
The SWAT files have been installed. Remember to read the documentation
1998-03-12 06:12:30 +03:00
for information on enabling and using SWAT
= = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = =
EOF
2006-02-24 03:30:09 +03:00
else
cat << EOF
= = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = =
The SWAT files have been removed. You may restore these files using
the command "make installswat" or "make install" to install binaries,
man pages, modules, SWAT, and shell scripts.
= = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = = =
EOF
fi
1998-03-12 06:12:30 +03:00
exit 0