#!/bin/sh
# Mount and view device

if [ -z "$EXPLORER" ]; then
   if [ `which emelfm` ]; then
      EXPLORER=emelfm
   elif [ `which xfe` ]; then
      EXPLORER=xfe
   fi
fi

# Looks how we call
NAME=`basename $0`
case $NAME in
  explorer_cd) 
     DEVICES="/mnt/cdrom /mnt/cdwriter"
     ;;
  explorer_fd)
     DEVICES="/mnt/floppy"
     ;;
  *)
     exec $EXPLORER
     exit 1  # never, but in case :)
     ;;
esac

for DEVICE in $DEVICES; do
  mount $DEVICE
  if [ $? = 0 ]; then
     $EXPLORER $DEVICE
     umount $DEVICE
     exit 0
  fi
done
Xdialog --title "ERROR"  --msgbox \
"\nCan not mount $DEVICES \n
Please make sure the device is ready,\n
or ask the admin for users permission" 0 0
exit 1

