1#!/bin/sh
2
3fndir=$DESTDIR$fndir
4scriptdir=$DESTDIR$scriptdir
5
6allfuncs="`grep ' functions=' ${dir_top}/config.modules |
7  sed -e '/^#/d' -e '/ link=no/d' -e 's/^.* functions=//'`"
8
9allfuncs="`cd ${sdir_top}; echo ${allfuncs}`"
10
11case $fndir in
12  *$VERSION*)
13     # Version specific function directory, safe to remove completely.
14     rm -rf $fndir
15     ;;
16  *) # The following will only apply with a custom install directory
17     # with no version information.  This is rather undesirable.
18     # But let's try and do the best we can.
19     # We now have a list of files, but we need to use `test -f' to check
20     # (1) the glob got expanded (2) we are not looking at directories.
21     for file in $allfuncs; do
22       case $file in
23       Scripts/*)
24	 ;;
25       *)
26         if test -f $sdir_top/$file; then
27	   if test x$FUNCTIONS_SUBDIRS != x -a x$FUNCTIONS_SUBDIRS != xno; then
28	     file=`echo $file | sed -e 's%%^(Functions|Completion)/%'`
29	     rm -f $fndir/$file
30	   else
31	     bfile="`echo $file | sed -e 's%^.*/%%'`"
32	     rm -f "$fndir/$bfile"
33	   fi
34         fi
35	 ;;
36       esac
37     done
38     ;;
39esac
40
41case $scriptdir in
42  *$VERSION*)
43     # $scriptdir might be the parent of fndir.
44     rm -rf $scriptdir
45     ;;
46  *) for file in $allfuncs; do
47	case $file in
48	Scripts/*)
49	  if test -f $sdir_top/$file; then
50	    bfile="`echo $file | sed -e 's%^.*/%%'`"
51	    rm -f "$scriptdir/$bfile"
52	  fi
53	  ;;
54	esac
55     done
56     ;;
57esac
58
59exit 0
60