#! /bin/sh

bindir=`dirname $0`
FILES="ndir lw lv uninstall-ndir"
MANPAGES="ndir.1 lv.1 lw.1"

cd $bindir
echo
echo "  ------------------------------------"
echo "  >>>  NDir Uninstallation Wizard  <<<"
echo "  ------------------------------------"
echo
echo -n "Trying to locate installation in "$bindir" ... "

if  test -f ndir && test -L lv && test -L lw;  then
  echo "Found."
  echo
  if  rm -f $FILES ;  then
    echo "Removing executables." 
  else
    echo "Cannot remove executables."
  fi
  
  cd $bindir/../man/man1
  if  test -f "ndir.1" && test -f "lv.1" && test -f "lw.1" ; then
    if  rm -f $MANPAGES ; then
      echo "Removing manpages."
    else
      echo "Cannot remove manpages."
    fi
  else
    echo "Cannot find manpages"
  fi
else
  echo 
  echo "Error: Installation not existing, damaged or of multi machine type."
  echo "Cannot proceed."
  echo "If you have a multi machine type installation, please uninstall manually."
fi
echo 
