#!/bin/sh
# Script used by kdesktop to eject a removable media (CDROM/Tape/SCSI/Floppy)
# Relies on the 'eject' program
#
# Copyright GPL v2 by David Faure <david@mandrakesoft.com>
#
# Note: This should be turned into a KDE app, or at least it should use
# kmessage, to show a message box in case of error.
#
if [ $# = 1 -a "$1" != "--help" ]; then
  # TODO: On bsd, it should be 'cdcontrol -f $1 eject'
  # Checking for stuff in the PATH is ugly with sh though.
  # I guess this is the reason for making this a kde app...
  if eject $1; then
    # Success -> update icon
    dcop kdesktop default refreshIcons
    exit 0
  else
    # Failure
    echo "eject $1 failed !"
  fi
else
  echo "Usage: $0 <name>  where name is a device or a mountpoint"
fi
exit 1

