#!/bin/sh
	
pt="/mnt/memstick";
if [ $# -gt 0 ] ; then
	pt="$1";
fi;

case "`uname`" in
	CYGWIN*)
		echo "Don't forget to stop your memory stick before removing it. (Unless you have XP)";
		exit 0;
		;;
	Darwin)
		echo "Attempting to unmount... if this hangs excessively, do it manually";
		drive=`disktool -l | grep "$pt" | cut -f 2 -d \'`;
		disktool -e $drive > /dev/null;
		echo "$pt unmounted, you may remove the memstick";
		;;
	*)
		printf "Attempting to unmount...";
		umount $pt;
		if [ $? -eq 0 ] ; then
			printf "successful.\n";
		else
			printf "an error occured.\n";
		fi;
		;;
esac
