From 9169edfeb4ea4358dbaf948372847542fb57464e Mon Sep 17 00:00:00 2001 From: Lars Müller Date: Fri, 24 Feb 2006 00:30:09 +0000 Subject: r13663: make uninstall DESTDIR=/somewhere no longer leaves files. This is done 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) --- source3/Makefile.in | 57 ++++++-- source3/configure.in | 14 ++ source3/script/installbin.sh | 13 +- source3/script/installdat.sh | 62 +++++++-- source3/script/installmodules.sh | 2 +- source3/script/installmsg.sh | 64 +++++++-- source3/script/installswat.sh | 271 ++++++++++++++++++++++++++++--------- source3/script/uninstallbin.sh | 28 ++-- source3/script/uninstalldat.sh | 1 + source3/script/uninstallmodules.sh | 22 +-- source3/script/uninstallmsg.sh | 1 + source3/script/uninstallswat.sh | 1 + 12 files changed, 400 insertions(+), 136 deletions(-) create mode 120000 source3/script/uninstalldat.sh create mode 120000 source3/script/uninstallmsg.sh create mode 120000 source3/script/uninstallswat.sh diff --git a/source3/Makefile.in b/source3/Makefile.in index 489abb9b4a..92e9e216d8 100644 --- a/source3/Makefile.in +++ b/source3/Makefile.in @@ -5,6 +5,7 @@ # Copyright Andrew Bartlett 2002 # Copyright (C) 2003 Jim McDonough # Copyright (C) 2002-2003 Jelmer Vernooij +# Copyright (C) 2006 Lars Mueller ########################################################################### 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@ diff --git a/source3/configure.in b/source3/configure.in index b3beb55c70..3f1600249e 100644 --- a/source3/configure.in +++ b/source3/configure.in @@ -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= diff --git a/source3/script/installbin.sh b/source3/script/installbin.sh index 2f15ce595a..8859c95341 100755 --- a/source3/script/installbin.sh +++ b/source3/script/installbin.sh @@ -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 diff --git a/source3/script/installdat.sh b/source3/script/installdat.sh index 4a5b1de5dc..5d7958e273 100755 --- a/source3/script/installdat.sh +++ b/source3/script/installdat.sh @@ -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 diff --git a/source3/script/installmodules.sh b/source3/script/installmodules.sh index 4ea8fde327..bfc1c359b5 100755 --- a/source3/script/installmodules.sh +++ b/source3/script/installmodules.sh @@ -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 diff --git a/source3/script/installmsg.sh b/source3/script/installmsg.sh index 5a41fe1ca8..3bfa3ee772 100644 --- a/source3/script/installmsg.sh +++ b/source3/script/installmsg.sh @@ -2,22 +2,64 @@ # first version (Sept 2003) written by Shiro Yamada # 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 diff --git a/source3/script/installswat.sh b/source3/script/installswat.sh index c5c285894e..095ccb897b 100755 --- a/source3/script/installswat.sh +++ b/source3/script/installswat.sh @@ -1,89 +1,152 @@ #!/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 diff --git a/source3/script/uninstallbin.sh b/source3/script/uninstallbin.sh index 5de936fccf..597c5d95a5 100755 --- a/source3/script/uninstallbin.sh +++ b/source3/script/uninstallbin.sh @@ -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 index 0000000000..656142745c --- /dev/null +++ b/source3/script/uninstalldat.sh @@ -0,0 +1 @@ +installdat.sh \ No newline at end of file diff --git a/source3/script/uninstallmodules.sh b/source3/script/uninstallmodules.sh index ac83af3dc9..194435bda3 100755 --- a/source3/script/uninstallmodules.sh +++ b/source3/script/uninstallmodules.sh @@ -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 index 0000000000..c108fa4416 --- /dev/null +++ b/source3/script/uninstallmsg.sh @@ -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 index 0000000000..0dffe646f0 --- /dev/null +++ b/source3/script/uninstallswat.sh @@ -0,0 +1 @@ +installswat.sh \ No newline at end of file -- cgit