#! /bin/sh

# Bernie Pope 2002
# shell script for initialising a directory for buddha
# a declarative debugger for Haskell

# create directory Buddha if it doesn't already exist 
if [ ! -d Buddha ]; then
   mkdir Buddha
fi

# see whether we were able to create it successfully
if [ ! -d Buddha ]; then
   echo "cannot create directory Buddha - perhaps you do not have permission?" 
   exit -1
fi

# create Buddha/mk.buddha.sh
if [ ! -r Buddha/mk.buddha.sh ]; then
   if [ ! -r /usr/local/lib/buddha-0.6/mk.buddha.sh ]; then
      echo "buddha has not been set up correctly"
      echo "cannot find /usr/local/lib/buddha-0.6/mk.buddha.sh"
      echo "try re-installing"
      exit -1
   else
      cp /usr/local/lib/buddha-0.6/mk.buddha.sh Buddha
   fi
fi

# create Buddha/Main.hs
if [ ! -r Buddha/Main.hs ]; then
   if [ ! -r /usr/local/lib/buddha-0.6/Main.hs ]; then
      echo "buddha has not been set up correctly"
      echo "cannot find /usr/local/lib/buddha-0.6/Main.hs"
      echo "try re-installing"
      exit -1
   else
      cp /usr/local/lib/buddha-0.6/Main.hs Buddha
   fi
fi
