#DOSEMUPATH=/usr/src/dosemu
DOSEMUPATH=.

if [ ! -d $DOSEMUPATH ]; then
  echo "$DOSEMUPATH does not exist"
  exit 1
fi
if [ ! -x ${DOSEMUPATH}/src/arch-linux/syscallmgr/insmod ]; then
  echo "${DOSEMUPATH}/src/arch-linux/syscallmgr/insmod does not exist"
  exit 1
fi
if [ ! -f ${DOSEMUPATH}/src/arch-linux/syscallmgr/syscallmgr.o ]; then
  echo "${DOSEMUPATH}/src/arch-linux/syscallmgr/syscallmgr.o does not exist"
  exit 1
fi      
if [ ! -f ${DOSEMUPATH}/src/arch-linux/emumod/emumodule.o ]; then
  echo "${DOSEMUPATH}/src/arch-linux/emumod/emumodule.o does not exist"
  exit 1
fi

if [ "`lsmod|grep emumodule`" != "" ]; then
  rmmod emumodule
fi
if [ "`lsmod|grep syscallmgr`" = "" ]; then
  ${DOSEMUPATH}/src/arch-linux/syscallmgr/insmod ${DOSEMUPATH}/src/arch-linux/syscallmgr/syscallmgr.o
fi
 
${DOSEMUPATH}/src/arch-linux/syscallmgr/insmod -z ${DOSEMUPATH}/src/arch-linux/emumod/emumodule.o
