#!/bin/sh
MOUNTPOINT=$1
MOUNTED="$(mount | grep $(echo "$MOUNTPOINT" | sed 's/\$/\\$/g;s/ /\\\\040/g'))$(mount | grep "$MOUNTPOINT")"
if [ "$MOUNTED" ];then
#smbumount "$MOUNTPOINT" #dependency on smbumount
umount-FULL "$MOUNTPOINT"
RESULT=$?
if [ "$RESULT" = 0 ]; then
	echo $MOUNTPOINT と切断しました >>${TMP}log
else
	export MAIN_DIALOG="<window title=\"Pnethood Error\" icon-name=\"gtk-network\"><vbox><text wrap=\"true\"><label>Unmount ${MOUNTPOINT} failed, share still in use. Please close all programs accessing this share. Hit the connect button then try disconnect again.</label></text><hbox homogeneous=\"true\"><pixmap icon_size=\"5\"><input file stock=\"gtk-dialog-error\"></input></pixmap><button ok></button></hbox></vbox></window>"
gtkdialog3 --program=MAIN_DIALOG --center
	echo $MOUNTPOINT の切断に失敗しました >> ${TMP}log
fi
else
echo 切断エラー $MOUNTPOINT は使われていません >> ${TMP}log
fi
