about summary refs log tree commit diff
path: root/Config/uninstallfns.sh
diff options
context:
space:
mode:
authorPeter Stephenson <pws@users.sourceforge.net>2000-11-30 18:36:21 +0000
committerPeter Stephenson <pws@users.sourceforge.net>2000-11-30 18:36:21 +0000
commita59b51006b307a1a3cbd79e6b85e6b80400cc8ab (patch)
treef57ffcc6593863c652ceb61a2930d55cb1b8ddc5 /Config/uninstallfns.sh
parent4b1191e209edecb5949b30038f310350e44273d3 (diff)
downloadzsh-a59b51006b307a1a3cbd79e6b85e6b80400cc8ab.tar.gz
zsh-a59b51006b307a1a3cbd79e6b85e6b80400cc8ab.tar.xz
zsh-a59b51006b307a1a3cbd79e6b85e6b80400cc8ab.zip
Function installation information now in config.modules
Diffstat (limited to 'Config/uninstallfns.sh')
-rwxr-xr-xConfig/uninstallfns.sh59
1 files changed, 33 insertions, 26 deletions
diff --git a/Config/uninstallfns.sh b/Config/uninstallfns.sh
index ae1b4fef5..963daad66 100755
--- a/Config/uninstallfns.sh
+++ b/Config/uninstallfns.sh
@@ -1,31 +1,38 @@
 #!/bin/sh
 
-# If the source directory is somewhere else, we need to force
-# the shell to expand it in that directory, then strip it off.
-install=
-for file in $FUNCTIONS_INSTALL; do
-  if test -f "$sdir/$file"; then
-    install="$install $file"
-  else
-    install="$install `echo $sdir/$file | sed -e \"s%$sdir/%%g\"`"
-  fi
-done
+fndir=$DESTDIR$fndir
 
-for file in $install; do
-  if test -f $sdir/$file; then
-    if test x$FUNCTIONS_SUBDIRS != x -a x$FUNCTIONS_SUBDIRS != xno; then
-      rm -f $fndir/$file;
-      if test -f $fndir.old/$file; then
-	mv $fndir.old/$file $fndir/$file
-      fi
-    else
-      bfile="`echo $file | sed -e 's%^.*/%%'`"
-      rm -f "$fndir/$bfile"; \
-      if test -f $fndir.old/$bfile; then
-        mv $fndir.old/$bfile $fndir/$bfile
-      fi
-    fi
-  fi
-done
+allfuncs="`grep ' functions=' ${dir_top}/config.modules |
+  sed -e '/^#/d' -e '/ link=no/d' -e 's/^.* functions=//'`"
+
+allfuncs="`cd ${sdir_top}; echo ${allfuncs}`"
+
+case $fndir in
+  *$VERSION*)
+     # Version specific function directory, safe to remove completely.
+     # However, we don't remove the top-level version directory since
+     # it could have other things than functions in it.  We could
+     # do that instead in the top-level Makefile on a full uninstall,
+     # if we wanted.
+     rm -rf $fndir
+     ;;
+  *) # The following will only apply with a custom install directory
+     # with no version information.  This is rather undesirable.
+     # But let's try and do the best we can.
+     # We now have a list of files, but we need to use `test -f' to check
+     # (1) the glob got expanded (2) we are not looking at directories.
+     for file in $allfuncs; do
+       if test -f $sdir_top/$file; then
+	 if test x$FUNCTIONS_SUBDIRS != x -a x$FUNCTIONS_SUBDIRS != xno; then
+	   file=`echo $file | sed -e 's%%^Completion/%' -e 's%%^Functions%'`
+	   rm -f $fndir/$file;
+	 else
+	   bfile="`echo $file | sed -e 's%^.*/%%'`"
+	   rm -f "$fndir/$bfile"; \
+	 fi
+       fi
+     done
+     ;;
+esac
 
 exit 0