r13663: make uninstall DESTDIR=/somewhere no longer leaves files. This is done
authorLars Müller <lmuelle@samba.org>
Fri, 24 Feb 2006 00:30:09 +0000 (00:30 +0000)
committerGerald (Jerry) Carter <jerry@samba.org>
Wed, 10 Oct 2007 16:10:21 +0000 (11:10 -0500)
with the new rules: uninstallservers uninstalldat, uninstallswat (calles
uninstallmsg), uninstallmodules, uninstallclientlib, and
uninstalllibmsrpc.

We still leave directories.  We might try to remove the dirs we created
in reverse order.

The new uninstall scripts are sym links to the respective install
scripts.  Inside we set mode to install or uninstall.

installservers is now used to install the servers.  These are no longer
installed with installbin.
(This used to be commit 43549301b937c060742840054017b31bf3781e04)

12 files changed:
source3/Makefile.in
source3/configure.in
source3/script/installbin.sh
source3/script/installdat.sh
source3/script/installmodules.sh
source3/script/installmsg.sh
source3/script/installswat.sh
source3/script/uninstallbin.sh
source3/script/uninstalldat.sh [new symlink]
source3/script/uninstallmodules.sh
source3/script/uninstallmsg.sh [new symlink]
source3/script/uninstallswat.sh [new symlink]

index 489abb9b4a0cd4f2ff4f63e70521955e9f6a36a5..92e9e216d8a7351c9313012b6d3022f0d865fe01 100644 (file)
@@ -5,6 +5,7 @@
 # Copyright Andrew Bartlett 2002
 # Copyright (C) 2003 Jim McDonough <jmcd@us.ibm.com>
 # Copyright (C) 2002-2003 Jelmer Vernooij <jelmer@samba.org>
+# Copyright (C) 2006 Lars Mueller <lars@samba.org>
 ###########################################################################
 
 prefix=@prefix@
@@ -38,6 +39,8 @@ LDAP_LIBS=@LDAP_LIBS@
 INSTALLCMD=@INSTALL@
 INSTALLLIBCMD_SH=@INSTALLLIBCMD_SH@
 INSTALLLIBCMD_A=@INSTALLLIBCMD_A@
+UNINSTALLLIBCMD_SH=@UNINSTALLLIBCMD_SH@
+UNINSTALLLIBCMD_A=@UNINSTALLLIBCMD_A@
 
 VPATH=@srcdir@
 srcdir=@abs_srcdir@
@@ -157,6 +160,9 @@ CHARSET_MODULES = @CHARSET_MODULES@
 AUTH_MODULES = @AUTH_MODULES@
 MODULES = $(VFS_MODULES) $(PDB_MODULES) $(RPC_MODULES) $(IDMAP_MODULES) $(CHARSET_MODULES) $(AUTH_MODULES)
 
+DAT_FILES = lowcase upcase valid
+SWAT_MSG_FILES = de en fr it ja nl pl tr
+
 ######################################################################
 # object file lists
 ######################################################################
@@ -1369,7 +1375,7 @@ bin/t_push_ucs2@EXEEXT@: bin/libbigballofmud.@SHLIBEXT@ torture/t_push_ucs2.o
 
 bin/t_snprintf@EXEEXT@: lib/snprintf.c
        $(CC) $(FLAGS) @PIE_LDFLAGS@ -o $@ $(DYNEXP) -DTEST_SNPRINTF lib/snprintf.c -lm
-install: installbin installman installscripts installdat installswat installmodules @INSTALL_LIBSMBCLIENT@ @INSTALL_LIBMSRPC@
+install: installservers installbin installman installscripts installdat installswat installmodules @INSTALL_LIBSMBCLIENT@ @INSTALL_LIBMSRPC@
 
 install-everything: install installmodules
 
@@ -1385,11 +1391,10 @@ installdirs:
        @$(SHELL) $(srcdir)/script/installdirs.sh $(INSTALLPERMS) $(DESTDIR) $(BASEDIR) $(BINDIR) $(SBINDIR) $(LIBDIR) $(VARDIR) $(PRIVATEDIR) $(PIDDIR) $(LOCKDIR) $(MANDIR)
 
 installservers: all installdirs
-       @$(SHELL) $(srcdir)/script/installbin.sh $(INSTALLPERMS) $(DESTDIR) $(BASEDIR) $(SBINDIR) $(LIBDIR) $(VARDIR) $(SBIN_PROGS)
+       @$(SHELL) $(srcdir)/script/installbin.sh $(INSTALLPERMS) $(DESTDIR) $(SBINDIR) $(SBIN_PROGS)
 
 installbin: all installdirs
-       @$(SHELL) $(srcdir)/script/installbin.sh $(INSTALLPERMS) $(DESTDIR) $(BASEDIR) $(SBINDIR) $(LIBDIR) $(VARDIR) $(SBIN_PROGS)
-       @$(SHELL) $(srcdir)/script/installbin.sh $(INSTALLPERMS) $(DESTDIR) $(BASEDIR) $(BINDIR) $(LIBDIR) $(VARDIR) $(BIN_PROGS)
+       @$(SHELL) $(srcdir)/script/installbin.sh $(INSTALLPERMS) $(DESTDIR) $(BINDIR) $(BIN_PROGS)
 
 
 # Some symlinks are required for the 'probing' of modules. 
@@ -1411,13 +1416,13 @@ installscripts: installdirs
        @$(SHELL) $(srcdir)/script/installscripts.sh $(INSTALLPERMS) $(DESTDIR)$(BINDIR) $(SCRIPTS)
 
 installdat: installdirs
-       @$(SHELL) $(srcdir)/script/installdat.sh $(DESTDIR)$(LIBDIR) $(srcdir)
+       @$(SHELL) $(srcdir)/script/installdat.sh $(DESTDIR) $(LIBDIR) $(srcdir) $(DAT_FILES)
 
 installmsg: installdirs
-       @$(SHELL) $(srcdir)/script/installmsg.sh $(DESTDIR)$(LIBDIR) $(srcdir)
+       @$(SHELL) $(srcdir)/script/installmsg.sh $(DESTDIR) $(LIBDIR) $(srcdir) $(SWAT_MSG_FILES)
 
 installswat: installdirs installmsg
-       @$(SHELL) $(srcdir)/script/installswat.sh $(DESTDIR)$(SWATDIR) $(srcdir)
+       @$(SHELL) $(srcdir)/script/installswat.sh $(DESTDIR) $(SWATDIR) $(srcdir)
 
 installclientlib: installdirs libsmbclient
        @$(SHELL) $(srcdir)/script/installdirs.sh $(INSTALLPERMS) $(DESTDIR) $(LIBDIR)
@@ -1489,25 +1494,47 @@ showlayout:
        @echo "  swatdir:     $(SWATDIR)"
 
 
-uninstall: uninstallman uninstallbin uninstallscripts uninstallmodules
+uninstall: uninstallman uninstallservers uninstallbin uninstallscripts uninstalldat uninstallswat uninstallmodules @UNINSTALL_LIBSMBCLIENT@ @UNINSTALL_LIBMSRPC@
 
 uninstallman:
        @$(SHELL) $(srcdir)/script/uninstallman.sh $(DESTDIR)$(MANDIR) $(srcdir) C
 
+uninstallservers:
+       @$(SHELL) $(srcdir)/script/uninstallbin.sh $(INSTALLPERMS) $(DESTDIR) $(SBINDIR) $(SBIN_PROGS)
+
 uninstallbin:
-       @$(SHELL) $(srcdir)/script/uninstallbin.sh $(INSTALLPERMS) $(DESTDIR)$(BASEDIR) $(DESTDIR)$(SBINDIR) $(DESTDIR)$(LIBDIR) $(DESTDIR)$(VARDIR) $(DESTDIR)$(SBIN_PROGS)
-       @$(SHELL) $(srcdir)/script/uninstallbin.sh $(INSTALLPERMS) $(DESTDIR)$(BASEDIR) $(DESTDIR)$(BINDIR) $(DESTDIR)$(LIBDIR) $(DESTDIR)$(VARDIR) $(DESTDIR)$(BIN_PROGS)
+       @$(SHELL) $(srcdir)/script/uninstallbin.sh $(INSTALLPERMS) $(DESTDIR) $(BINDIR) $(BIN_PROGS)
 
 uninstallmodules:
-       @$(SHELL) $(srcdir)/script/uninstallmodules.sh $(INSTALLPERMS) $(DESTDIR)$(BASEDIR) $(DESTDIR)$(VFSLIBDIR) $(DESTDIR)$(VFS_MODULES)
-       @$(SHELL) $(srcdir)/script/uninstallmodules.sh $(INSTALLPERMS) $(DESTDIR)$(BASEDIR) $(DESTDIR)$(PDBLIBDIR) $(DESTDIR)$(PDB_MODULES)
-       @$(SHELL) $(srcdir)/script/uninstallmodules.sh $(INSTALLPERMS) $(DESTDIR)$(BASEDIR) $(DESTDIR)$(RPCLIBDIR) $(DESTDIR)$(RPC_MODULES)
-       @$(SHELL) $(srcdir)/script/uninstallmodules.sh $(INSTALLPERMS) $(DESTDIR)$(BASEDIR) $(DESTDIR)$(CHARSETLIBDIR) $(DESTDIR)$(CHARSET_MODULES)
-       @$(SHELL) $(srcdir)/script/uninstallmodules.sh $(INSTALLPERMS) $(DESTDIR)$(BASEDIR) $(DESTDIR)$(AUTHLIBDIR) $(DESTDIR)$(AUTH_MODULES)
+       @$(SHELL) $(srcdir)/script/uninstallmodules.sh $(INSTALLPERMS) $(DESTDIR) $(BASEDIR) $(VFSLIBDIR) $(VFS_MODULES)
+       @$(SHELL) $(srcdir)/script/uninstallmodules.sh $(INSTALLPERMS) $(DESTDIR) $(BASEDIR) $(PDBLIBDIR) $(PDB_MODULES)
+       @$(SHELL) $(srcdir)/script/uninstallmodules.sh $(INSTALLPERMS) $(DESTDIR) $(BASEDIR) $(RPCLIBDIR) $(RPC_MODULES)
+       @$(SHELL) $(srcdir)/script/uninstallmodules.sh $(INSTALLPERMS) $(DESTDIR) $(BASEDIR) $(IDMAPLIBDIR) $(IDMAP_MODULES)
+       @$(SHELL) $(srcdir)/script/uninstallmodules.sh $(INSTALLPERMS) $(DESTDIR) $(BASEDIR) $(CHARSETLIBDIR) $(CHARSET_MODULES)
+       @$(SHELL) $(srcdir)/script/uninstallmodules.sh $(INSTALLPERMS) $(DESTDIR) $(BASEDIR) $(AUTHLIBDIR) $(AUTH_MODULES)
 
 uninstallscripts:
        @$(SHELL) $(srcdir)/script/uninstallscripts.sh $(INSTALLPERMS) $(DESTDIR)$(BINDIR) $(SCRIPTS)
 
+uninstalldat:
+       @$(SHELL) $(srcdir)/script/uninstalldat.sh $(DESTDIR) $(LIBDIR) $(srcdir) $(DAT_FILES)
+
+uninstallmsg:
+       @$(SHELL) $(srcdir)/script/uninstallmsg.sh $(DESTDIR) $(LIBDIR) $(srcdir) $(SWAT_MSG_FILES)
+
+uninstallswat: uninstallmsg
+       @$(SHELL) $(srcdir)/script/uninstallswat.sh $(DESTDIR) $(SWATDIR) $(srcdir)
+
+uninstallclientlib: installdirs libsmbclient
+       -$(UNINSTALLLIBCMD_SH) $(DESTDIR)$(LIBDIR)/libsmbclient.@SHLIBEXT@
+       -$(UNINSTALLLIBCMD_A) $(DESTDIR)$(LIBDIR)/libsmbclient.a
+       -rm -f $(DESTDIR)${prefix}/include/libsmbclient.h
+
+uninstalllibmsrpc: installdirs libmsrpc
+       -$(UNINSTALLLIBCMD_SH) $(DESTDIR)$(LIBDIR)/libmsrpc.@SHLIBEXT@
+       -$(UNINSTALLLIBCMD_A) $(DESTDIR)$(LIBDIR)/libmsrpc.a
+       -rm -f $(DESTDIR)${prefix}/include/libmsrpc.h
+
 # Toplevel clean files
 TOPFILES=dynconfig.o dynconfig.@PICSUFFIX@
 
index b3beb55c702f5606ede852436b645ba7ccaf9513..3f1600249e551969cf527edf892c34c5235ab90a 100644 (file)
@@ -217,10 +217,14 @@ AC_SUBST(PIE_LDFLAGS)
 AC_SUBST(SHLIBEXT)
 AC_SUBST(INSTALLLIBCMD_SH)
 AC_SUBST(INSTALLLIBCMD_A)
+AC_SUBST(UNINSTALLLIBCMD_SH)
+AC_SUBST(UNINSTALLLIBCMD_A)
 AC_SUBST(INSTALL_LIBMSRPC)
+AC_SUBST(UNINSTALL_LIBMSRPC)
 AC_SUBST(LIBMSRPC_SHARED)
 AC_SUBST(LIBMSRPC)
 AC_SUBST(INSTALL_LIBSMBCLIENT)
+AC_SUBST(UNINSTALL_LIBSMBCLIENT)
 AC_SUBST(LIBSMBCLIENT_SHARED)
 AC_SUBST(LIBSMBCLIENT)
 AC_SUBST(INSTALL_LIBSMBSHAREMODES)
@@ -4081,17 +4085,22 @@ fi
 
 INSTALLLIBCMD_SH=:
 INSTALLLIBCMD_A=:
+UNINSTALLLIBCMD_SH=:
+UNINSTALLLIBCMD_A=:
 
 if test $BLDSHARED = true; then
        INSTALLLIBCMD_SH="\$(INSTALLCMD)"
+       UNINSTALLLIBCMD_SH="rm -f"
 fi
 if test $enable_static = yes; then
        INSTALLLIBCMD_A="\$(INSTALLCMD)"
+       UNINSTALLLIBCMD_A="rm -f"
 fi
 
 #################################################
 # should we build libmsrpc?
 INSTALL_LIBMSRPC=
+UNINSTALL_LIBMSRPC=
 LIBMSRPC_SHARED=
 LIBMSRPC=
 AC_MSG_CHECKING(whether to build the libmsrpc shared library)
@@ -4114,6 +4123,7 @@ AC_ARG_WITH(libmsrpc,
         LIBMSRPC=libmsrpc
      fi
      INSTALL_LIBMSRPC=installlibmsrpc
+     UNINSTALL_LIBMSRPC=uninstalllibmsrpc
      ;;
   esac ],
 [
@@ -4130,11 +4140,13 @@ AC_ARG_WITH(libmsrpc,
      LIBMSRPC=libmsrpc
   fi]
   INSTALL_LIBMSRPC=installlibmsrpc
+  UNINSTALL_LIBMSRPC=uninstalllibmsrpc
 )
 
 #################################################
 # should we build libsmbclient?
 INSTALL_LIBSMBCLIENT=
+UNINSTALL_LIBSMBCLIENT=
 LIBSMBCLIENT_SHARED=
 LIBSMBCLIENT=
 AC_MSG_CHECKING(whether to build the libsmbclient shared library)
@@ -4157,6 +4169,7 @@ AC_ARG_WITH(libsmbclient,
         LIBSMBCLIENT=libsmbclient
      fi
      INSTALL_LIBSMBCLIENT=installclientlib
+     UNINSTALL_LIBSMBCLIENT=uninstallclientlib
      ;;
   esac ],
 [
@@ -4173,6 +4186,7 @@ AC_ARG_WITH(libsmbclient,
      LIBSMBCLIENT=libsmbclient
   fi]
   INSTALL_LIBSMBCLIENT=installclientlib
+  UNINSTALL_LIBSMBCLIENT=uninstallclientlib
 )
 
 INSTALL_LIBSMBSHAREMODES=
index 2f15ce595a6bc657b1a2725d2fb1e05fc97682d1..8859c953414d26c9afea2a30db76117de29974f6 100755 (executable)
@@ -2,20 +2,14 @@
 
 INSTALLPERMS=$1
 DESTDIR=$2
-BASEDIR=`echo $3 | sed 's/\/\//\//g'`
-BINDIR=`echo $4 | sed 's/\/\//\//g'`
-LIBDIR=`echo $5 | sed 's/\/\//\//g'`
-VARDIR=`echo $6 | sed 's/\/\//\//g'`
-shift
-shift
-shift
+BINDIR=`echo $3 | sed 's/\/\//\//g'`
 shift
 shift
 shift
 
 for p in $*; do
  p2=`basename $p`
- echo Installing $p as $DESTDIR/$BINDIR/$p2
+ echo "Installing $p as $DESTDIR/$BINDIR/$p2 "
  if [ -f $DESTDIR/$BINDIR/$p2 ]; then
    rm -f $DESTDIR/$BINDIR/$p2.old
    mv $DESTDIR/$BINDIR/$p2 $DESTDIR/$BINDIR/$p2.old
@@ -27,7 +21,8 @@ for p in $*; do
  if [ $p2 = smbmount ]; then
    if [ ! -d $DESTDIR/sbin ]; then
       mkdir $DESTDIR/sbin
-   fi 
+   fi
+   echo "Creating sym link $DESTDIR/sbin/mount.smbfs to $BINDIR/$p2 "
    ln -sf $BINDIR/$p2 $DESTDIR/sbin/mount.smbfs
  fi
 done
index 4a5b1de5dc86921ce0a1aad2bda04cce9a0b5893..5d7958e27370cfa08b82b711338f7617b51ffae0 100755 (executable)
@@ -1,23 +1,65 @@
 #!/bin/sh
 #fist version March 2002, Herb  Lewis
 
-DATDIR=`echo $1 | sed 's/\/\//\//g'`
-SRCDIR=$2/
+DESTDIR=$1
+DATDIR=`echo $2 | sed 's/\/\//\//g'`
+SRCDIR=$3/
+shift
+shift
+shift
 
-echo Installing dat files in $DATDIR
+case $0 in
+       *uninstall*)
+               if test ! -d "$DESTDIR/$DATDIR"; then
+                       echo "Directory $DESTDIR/$DATDIR does not exist! "
+                       echo "Do a "make installmsg" or "make install" first. "
+                       exit 1
+               fi
+               mode='uninstall'
+               ;;
+       *) mode='install' ;;    
+esac
 
-for f in $SRCDIR/codepages/*.dat; do
-       FNAME=$DATDIR/`basename $f`
-       echo $FNAME
-       cp $f $FNAME || echo Cannot install $FNAME. Does $USER have privileges?
-       chmod 0644 $FNAME
+for f in $@; do
+       FNAME="$DESTDIR/$DATDIR/$f.dat"
+       if test "$mode" = 'install'; then
+               echo "Installing $f.dat as $FNAME "
+               cp "$SRCDIR/codepages/$f.dat" "$FNAME"
+               if test ! -e "$FNAME"; then
+                       echo "Cannot install $FNAME.  Does $USER have privileges? "
+                       exit 1
+               fi
+               chmod 0644 $FNAME
+       elif test "$mode" = 'uninstall'; then
+               echo "Removing $FNAME "
+               rm -f "$FNAME"
+               if test -e "$FNAME"; then
+                       echo "Cannot remove $FNAME.  Does $USER have privileges? "
+                       exit 1
+               fi
+       else
+               echo "Unknown mode, $mode.  Script called as $0 "
+               exit 1
+       fi
 done
 
-cat << EOF
+if test "$mode" = 'install'; then
+       cat << EOF
 ======================================================================
-The dat files have been installed. 
+The dat files have been installed.  You may uninstall the dat files
+using the command "make uninstalldat" or "make uninstall" to uninstall
+binaries, man pages, dat files, and shell scripts.
 ======================================================================
 EOF
+else
+       cat << EOF
+======================================================================
+The dat files have been removed.  You may restore these files using
+the command "make installdat" or "make install" to install binaries, 
+man pages, modules, dat files, and shell scripts.
+======================================================================
+EOF
+fi
 
 exit 0
 
index 4ea8fde327dbc74ee39681b510b6d358a24dfbc0..bfc1c359b519289b27caa40baaf25948a6b71e0b 100755 (executable)
@@ -1,7 +1,7 @@
 #!/bin/sh
 
 INSTALLPERMS=$1
-DESTDIR=`echo $2 | sed 's/\/\//\//g'`
+DESTDIR=$2
 BASEDIR=`echo $3 | sed 's/\/\//\//g'`
 LIBDIR=`echo $4 | sed 's/\/\//\//g'`
 shift
index 5a41fe1ca8db93d2e4acc165ea9f5c8156f414b0..3bfa3ee772b0f43ae1ce4b00ebcc7f947845b420 100644 (file)
@@ -2,22 +2,64 @@
 # first version (Sept 2003) written by Shiro Yamada <shiro@miraclelinux.com>
 # based on the first verion (March 2002) of installdat.sh written by Herb Lewis
 
-MSGDIR=`echo $1 | sed 's/\/\//\//g'`
-SRCDIR=$2/
+DESTDIR=$1
+MSGDIR=`echo $2 | sed 's/\/\//\//g'`
+SRCDIR=$3/
+shift
+shift
+shift
 
-echo Installing msg files in $MSGDIR
+case $0 in
+       *uninstall*)
+               if test ! -d "$DESTDIR/$MSGDIR"; then
+                       echo "Directory $DESTDIR/$MSGDIR does not exist! "
+                       echo "Do a "make installmsg" or "make install" first. "
+                       exit 1
+               fi
+               mode='uninstall'
+               ;;
+       *) mode='install' ;;
+esac
 
-for f in $SRCDIR/po/*.msg; do
-       FNAME=$MSGDIR/`basename $f`
-       echo $FNAME
-       cp $f $FNAME || echo Cannot install $FNAME. Does $USER have privileges?
-       chmod 0644 $FNAME
+for f in $@; do
+       FNAME="$DESTDIR/$MSGDIR/$f.msg"
+       if test "$mode" = 'install'; then
+               echo "Installing $f.msg as $FNAME "
+               cp "$SRCDIR/po/$f.msg" "$FNAME"
+               if test ! -e "$FNAME"; then
+                       echo "Cannot install $FNAME.  Does $USER have privileges? "
+                       exit 1
+               fi
+               chmod 0644 $FNAME
+       elif test "$mode" = 'uninstall'; then
+               echo "Removing $FNAME "
+               rm -f "$FNAME"
+               if test -e "$FNAME"; then
+                       echo "Cannot remove $FNAME.  Does $USER have privileges? "
+                       exit 1
+               fi
+       else
+               echo "Unknown mode, $mode.  Script called as $0 "
+               exit 1
+       fi
 done
 
-cat << EOF
-======================================================================
-The msg files have been installed. 
+if test "$mode" = 'install'; then
+       cat << EOF
+==============================================================================
+The SWAT msg files have been installed.  You may uninstall the msg files using
+the command "make uninstallmsg" or "make uninstall" to uninstall binaries, man
+pages, msg files, and shell scripts.
+==============================================================================
+EOF
+else
+       cat << EOF
+=============================================================================
+The SWAT msg files have been removed.  You may restore these files using the
+command "make installmsg" or "make install" to install binaries, man pages,
+modules, msg files, and shell scripts.
 ======================================================================
 EOF
+fi
 
 exit 0
index c5c285894e7bf5945388d46ee0a9abca70d493ce..095ccb897b60efcb52fa256f30bc05112ad27e6c 100755 (executable)
 #!/bin/sh
 #first version March 1998, Andrew Tridgell
 
-SWATDIR=`echo $1 | sed 's/\/\//\//g'`
-SRCDIR=$2/
-BOOKDIR=$SWATDIR/using_samba
+DESTDIR=$1
+SWATDIR=`echo $2 | sed 's/\/\//\//g'`
+SRCDIR=$3/
+BOOKDIR="$DESTDIR/$SWATDIR/using_samba"
 
-echo Installing SWAT in $SWATDIR
-echo Installing the Samba Web Administration Tool
+case $0 in
+       *uninstall*)
+               echo "Removing SWAT from $DESTDIR/$SWATDIR "
+               echo "Removing the Samba Web Administration Tool "
+               echo -n "Removed "
+               mode='uninstall'
+               ;;
+       *)
+               echo "Installing SWAT in $DESTDIR/$SWATDIR "
+               echo "Installing the Samba Web Administration Tool "
+               echo -n "Installing "
+               mode='install'
+               ;;
+esac
 
 LANGS=". `cd $SRCDIR../swat/; /bin/echo lang/??`"
-echo Installing langs are `cd $SRCDIR../swat/lang/; /bin/echo ??`
+echo "langs are `cd $SRCDIR../swat/lang/; /bin/echo ??` "
 
-for ln in $LANGS; do 
- SWATLANGDIR=$SWATDIR/$ln
- for d in $SWATLANGDIR $SWATLANGDIR/help $SWATLANGDIR/images \
-       $SWATLANGDIR/include $SWATLANGDIR/js; do
+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
     if [ ! -d $d ]; then
-       mkdir -p $d
-       if [ ! -d $d ]; then
-           echo Failed to make directory $d, does $USER have privileges?
-           exit 1
-       fi
+     echo "Failed to make directory $d, does $USER have privileges? "
+     exit 1
     fi
+   fi
+  done
  done
-done
+fi
 
-# Install images
 for ln in $LANGS; do
 
+  # images
   for f in $SRCDIR../swat/$ln/images/*.png; do
-      if [ ! -f $f ] ; then
-       continue
+    if [ ! -f $f ] ; then
+      continue
+    fi
+    FNAME="$DESTDIR/$SWATDIR/$ln/images/`basename $f`"
+    echo $FNAME
+    if test "$mode" = 'install'; then
+      cp "$f" "$FNAME"
+      if test ! -e "$FNAME"; then
+        echo "Cannot install $FNAME. Does $USER have privileges? "
+        exit 1
       fi
-      FNAME=$SWATDIR/$ln/images/`basename $f`
-      echo $FNAME
-      cp $f $FNAME || echo Cannot install $FNAME. Does $USER have privileges?
-      chmod 0644 $FNAME
+      chmod 0644 "$FNAME"
+    elif test "$mode" = 'uninstall'; then
+      rm -f "$FNAME"
+      if test -e "$FNAME"; then
+        echo "Cannot remove $FNAME.  Does $USER have privileges? "
+        exit 1
+      fi
+    else
+      echo "Unknown mode, $mode.  Script called as $0 "
+      exit 1
+    fi
   done
 
-  # Install html help
-
+  # html help
   for f in $SRCDIR../swat/$ln/help/*.html; do
-      if [ ! -f $f ] ; then
-       continue
-      fi
-      FNAME=$SWATDIR/$ln/help/`basename $f`
-      echo $FNAME
+    if [ ! -f $f ] ; then
+      continue
+    fi
+    FNAME="$DESTDIR/$SWATDIR/$ln/help/`basename $f`"
+    echo $FNAME
+    if test "$mode" = 'install'; then
       if [ "x$BOOKDIR" = "x" ]; then
         cat $f | sed 's/@BOOKDIR@.*$//' > $f.tmp
       else
         cat $f | sed 's/@BOOKDIR@//' > $f.tmp
       fi
       f=$f.tmp
-      cp $f $FNAME || echo Cannot install $FNAME. Does $USER have privileges?
-      rm -f $f
-      chmod 0644 $FNAME
+      cp "$f" "$FNAME"
+      rm -f "$f"
+      if test ! -e "$FNAME"; then
+        echo "Cannot install $FNAME. Does $USER have privileges? "
+        exit 1
+      fi
+      chmod 0644 "$FNAME"
+    elif test "$mode" = 'uninstall'; then
+      rm -f "$FNAME"
+      if test -e "$FNAME"; then
+        echo "Cannot remove $FNAME.  Does $USER have privileges? "
+        exit 1
+      fi
+    fi
   done
 
-  # Install "server-side" includes
-
+  # "server-side" includes
   for f in $SRCDIR../swat/$ln/include/*; do
       if [ ! -f $f ] ; then
        continue
       fi
-      FNAME=$SWATDIR/$ln/include/`basename $f`
+      FNAME="$DESTDIR/$SWATDIR/$ln/include/`basename $f`"
       echo $FNAME
-      cp $f $FNAME || echo Cannot install $FNAME. Does $USER have privileges?
-      chmod 0644 $FNAME
+      if test "$mode" = 'install'; then
+        cp "$f" "$FNAME"
+        if test ! -e "$FNAME"; then
+          echo "Cannot install $FNAME. Does $USER have privileges? "
+          exit 1
+        fi
+        chmod 0644 $FNAME
+      elif test "$mode" = 'uninstall'; then
+        rm -f "$FNAME"
+        if test -e "$FNAME"; then
+          echo "Cannot remove $FNAME.  Does $USER have privileges? "
+          exit 1
+        fi
+      fi
   done
 
-  # Install javascripts
-
+  # javascripts
   for f in $SRCDIR../swat/$ln/js/*.js; do
       if [ ! -f $f ] ; then
        continue
       fi
-      FNAME=$SWATDIR/$ln/js/`basename $f`
+      FNAME="$DESTDIR/$SWATDIR/$ln/js/`basename $f`"
       echo $FNAME
-      cp $f $FNAME || echo Cannot install $FNAME. Does $USER have privileges?
-      chmod 0644 $FNAME
+      if test "$mode" = 'install'; then
+        cp "$f" "$FNAME"
+        if test ! -e "$FNAME"; then
+          echo "Cannot install $FNAME. Does $USER have privileges? "
+          exit 1
+        fi
+        chmod 0644 $FNAME
+      elif test "$mode" = 'uninstall'; then
+        rm -f "$FNAME"
+        if test -e "$FNAME"; then
+          echo "Cannot remove $FNAME.  Does $USER have privileges? "
+          exit 1
+        fi
+      fi
   done
 
 done
 
-# Install html documentation (if html documentation tree is here)
+# Install/ remove html documentation (if html documentation tree is here)
 
 if [ -d $SRCDIR../docs/htmldocs/ ]; then
 
@@ -94,47 +157,75 @@ if [ -d $SRCDIR../docs/htmldocs/ ]; then
         continue
       fi
       
-      INSTALLDIR=$SWATDIR/help/`echo $dir | sed 's/htmldocs\///g'`
-      if [ ! -d $INSTALLDIR ]; then
-        mkdir $INSTALLDIR
+      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
       fi
 
       for f in $SRCDIR../docs/$dir/*.html; do
          FNAME=$INSTALLDIR/`basename $f`
          echo $FNAME
-         cp $f $FNAME || echo Cannot install $FNAME. Does $USER have privileges?
-         chmod 0644 $FNAME
+          if test "$mode" = 'install'; then
+            cp "$f" "$FNAME"
+            if test ! -e "$FNAME"; then
+              echo "Cannot install $FNAME. Does $USER have privileges? "
+              exit 1
+            fi
+            chmod 0644 $FNAME
+          elif test "$mode" = 'uninstall'; then
+            rm -f "$FNAME"
+            if test -e "$FNAME"; then
+              echo "Cannot remove $FNAME.  Does $USER have privileges? "
+              exit 1
+            fi
+          fi
       done
 
-      if [ -d $SRCDIR../docs/$dir/images/ ]; then
-          if [ ! -d $INSTALLDIR/images/ ]; then
-              mkdir $INSTALLDIR/images
-              if [ ! -d $INSTALLDIR/images/ ]; then
-                  echo Failed to make directory $SWATDIR/help/images, does $USER have privileges?
+      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? "
                   exit 1
               fi
           fi
           for f in $SRCDIR../docs/$dir/images/*.png; do
               FNAME=$INSTALLDIR/images/`basename $f`
               echo $FNAME
-              cp $f $FNAME || echo Cannot install $FNAME. Does $USER have privileges?
-              chmod 0644 $FNAME
+              if test "$mode" = 'install'; then
+                cp "$f" "$FNAME"
+                if test ! -e "$FNAME"; then
+                  echo "Cannot install $FNAME. Does $USER have privileges? "
+                  exit 1
+                fi
+                chmod 0644 $FNAME
+              elif test "$mode" = 'uninstall'; then
+                rm -f "$FNAME"
+                if test -e "$FNAME"; then
+                  echo "Cannot remove $FNAME.  Does $USER have privileges? "
+                  exit 1
+                fi
+              fi
           done
       fi
     done
 fi
 
-# Install Using Samba book (but only if it is there)
+# Install/ remove Using Samba book (but only if it is there)
 
 if [ "x$BOOKDIR" != "x" -a -f $SRCDIR../docs/htmldocs/using_samba/toc.html ]; then
 
     # Create directories
 
     for d in $BOOKDIR $BOOKDIR/figs ; do
-        if [ ! -d $d ]; then
+        if test ! -d "$d" -a "$mode" = 'install'; then
             mkdir $d
-            if [ ! -d $d ]; then
-                echo Failed to make directory $d, does $USER have privileges?
+            if test ! -d "$d"; then
+                echo "Failed to make directory $d, does $USER have privileges? "
                 exit 1
             fi
         fi
@@ -145,15 +236,39 @@ if [ "x$BOOKDIR" != "x" -a -f $SRCDIR../docs/htmldocs/using_samba/toc.html ]; th
     for f in $SRCDIR../docs/htmldocs/using_samba/*.html; do
         FNAME=$BOOKDIR/`basename $f`
         echo $FNAME
-        cp $f $FNAME || echo Cannot install $FNAME. Does $USER have privileges?
-        chmod 0644 $FNAME
+        if test "$mode" = 'install'; then
+          cp "$f" "$FNAME"
+          if test ! -e "$FNAME"; then
+            echo "Cannot install $FNAME. Does $USER have privileges? "
+            exit 1
+          fi
+          chmod 0644 $FNAME
+        elif test "$mode" = 'uninstall'; then
+          rm -f "$FNAME"
+          if test -e "$FNAME"; then
+            echo "Cannot remove $FNAME.  Does $USER have privileges? "
+            exit 1
+          fi
+        fi
     done
 
     for f in $SRCDIR../docs/htmldocs/using_samba/*.gif; do
         FNAME=$BOOKDIR/`basename $f`
         echo $FNAME
-        cp $f $FNAME || echo Cannot install $FNAME. Does $USER have privileges?
-        chmod 0644 $FNAME
+        if test "$mode" = 'install'; then
+          cp "$f" "$FNAME"
+          if test ! -e "$FNAME"; then
+            echo "Cannot install $FNAME. Does $USER have privileges? "
+            exit 1
+          fi
+          chmod 0644 $FNAME
+        elif test "$mode" = 'uninstall'; then
+          rm -f "$FNAME"
+          if test -e "$FNAME"; then
+            echo "Cannot remove $FNAME.  Does $USER have privileges? "
+            exit 1
+          fi
+        fi
     done
 
     # Figures
@@ -161,18 +276,40 @@ if [ "x$BOOKDIR" != "x" -a -f $SRCDIR../docs/htmldocs/using_samba/toc.html ]; th
     for f in $SRCDIR../docs/htmldocs/using_samba/figs/*.gif; do
         FNAME=$BOOKDIR/figs/`basename $f`
         echo $FNAME
-        cp $f $FNAME || echo Cannot install $FNAME. Does $USER have privileges?
-        chmod 0644 $FNAME
+        if test "$mode" = 'install'; then
+          cp "$f" "$FNAME"
+          if test ! -e "$FNAME"; then
+            echo "Cannot install $FNAME. Does $USER have privileges? "
+            exit 1
+          fi
+          chmod 0644 $FNAME
+        elif test "$mode" = 'uninstall'; then
+          rm -f "$FNAME"
+          if test -e "$FNAME"; then
+            echo "Cannot remove $FNAME.  Does $USER have privileges? "
+            exit 1
+          fi
+        fi
     done
 
 fi
 
-cat << EOF
+if test "$mode" = 'install'; then
+  cat << EOF
 ======================================================================
 The SWAT files have been installed. Remember to read the documentation
 for information on enabling and using SWAT
 ======================================================================
 EOF
+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
 
 exit 0
 
index 5de936fccfd3d3e5e750fca0116368a76bc1c8b9..597c5d95a520cdced71cf2e2d6a939f62e45fe16 100755 (executable)
@@ -2,31 +2,33 @@
 #4 July 96 Dan.Shearer@UniSA.edu.au   
 
 INSTALLPERMS=$1
-BASEDIR=`echo $2 | sed 's/\/\//\//g'`
+DESTDIR=$2
 BINDIR=`echo $3 | sed 's/\/\//\//g'`
-LIBDIR=`echo $4 | sed 's/\/\//\//g'`
-VARDIR=`echo $5 | sed 's/\/\//\//g'`
-shift
-shift
 shift
 shift
 shift
 
-if [ ! -d $BINDIR ]; then
-  echo Directory $BINDIR does not exist!
-  echo Do a "make installbin" or "make install" first.
+if [ ! -d $DESTDIR/$BINDIR ]; then
+  echo "Directory $DESTDIR/$BINDIR does not exist! "
+  echo "Do a "make installbin" or "make install" first. "
   exit 1
 fi
 
 for p in $*; do
   p2=`basename $p`
-  if [ -f $BINDIR/$p2 ]; then
-    echo Removing $BINDIR/$p2
-    rm -f $BINDIR/$p2
-    if [ -f $BINDIR/$p2 ]; then
-      echo Cannot remove $BINDIR/$p2 ... does $USER have privileges?
+  if [ -f $DESTDIR/$BINDIR/$p2 ]; then
+    echo "Removing $DESTDIR/$BINDIR/$p2 "
+    rm -f $DESTDIR/$BINDIR/$p2
+    if [ -f $DESTDIR/$BINDIR/$p2 ]; then
+      echo "Cannot remove $DESTDIR/$BINDIR/$p2 ... does $USER have privileges? "
     fi
   fi
+
+  # this is a special case, mount needs this in a specific location
+  if test "$p2" = smbmount -a -e "$DESTDIR/sbin/mount.smbfs"; then
+    echo "Removing $DESTDIR/sbin/mount.smbfs "
+    rm -f "$DESTDIR/sbin/mount.smbfs"
+  fi
 done
 
 
diff --git a/source3/script/uninstalldat.sh b/source3/script/uninstalldat.sh
new file mode 120000 (symlink)
index 0000000..6561427
--- /dev/null
@@ -0,0 +1 @@
+installdat.sh
\ No newline at end of file
index ac83af3dc9057aa006c93f2f965bdfa712f62719..194435bda3c2527d4772d79f043dfca66b318716 100755 (executable)
@@ -2,25 +2,27 @@
 #4 July 96 Dan.Shearer@UniSA.edu.au   
 
 INSTALLPERMS=$1
-BASEDIR=`echo $2 | sed 's/\/\//\//g'`
-LIBDIR=`echo $3 | sed 's/\/\//\//g'`
+DESTDIR=$2
+BASEDIR=`echo $3 | sed 's/\/\//\//g'`
+LIBDIR=`echo $4 | sed 's/\/\//\//g'`
+shift
 shift
 shift
 shift
 
-if [ ! -d $LIBDIR ]; then
-  echo Directory $LIBDIR does not exist!
-  echo Do a "make installmodules" or "make install" first.
+if [ ! -d $DESTDIR/$LIBDIR ]; then
+  echo "Directory $DESTDIR/$LIBDIR does not exist! "
+  echo "Do a "make installmodules" or "make install" first. "
   exit 1
 fi
 
 for p in $*; do
   p2=`basename $p`
-  if [ -f $LIBDIR/$p2 ]; then
-    echo Removing $LIBDIR/$p2
-    rm -f $LIBDIR/$p2
-    if [ -f $LIBDIR/$p2 ]; then
-      echo Cannot remove $LIBDIR/$p2 ... does $USER have privileges?
+  if [ -f $DESTDIR/$LIBDIR/$p2 ]; then
+    echo "Removing $DESTDIR/$LIBDIR/$p2 "
+    rm -f $DESTDIR/$LIBDIR/$p2
+    if [ -f $DESTDIR/$LIBDIR/$p2 ]; then
+      echo "Cannot remove $DESTDIR/$LIBDIR/$p2 ... does $USER have privileges? "
     fi
   fi
 done
diff --git a/source3/script/uninstallmsg.sh b/source3/script/uninstallmsg.sh
new file mode 120000 (symlink)
index 0000000..c108fa4
--- /dev/null
@@ -0,0 +1 @@
+installmsg.sh
\ No newline at end of file
diff --git a/source3/script/uninstallswat.sh b/source3/script/uninstallswat.sh
new file mode 120000 (symlink)
index 0000000..0dffe64
--- /dev/null
@@ -0,0 +1 @@
+installswat.sh
\ No newline at end of file