#!/bin/bash

# monta una ISO nella cartella selezionata

OPENFILE=`cat $HOME/acetonesm`

rm -rf $HOME/acetonesm

fusermount -u -z "$OPENFILE"

OPENFILE2=`kdialog --icon /usr/share/pixmaps/Acetino2.png --caption "Select Image to be Mounted" --getopenfilename $HOME/ "*.iso *.bin *.img *.mdf *.nrg |All supported Images"`

if test -z $OPENFILE2
then
exit
fi

mkdir "$OPENFILE"/test
if test ! -e "$OPENFILE"/test
then
kdialog --caption "AcetoneISO" --error "Impossible to mount\nThe folder doesn't belong to Your user"
exit
else
rm -rf "$OPENFILE"/test

fi


fuseiso "$OPENFILE2" "$OPENFILE" -o nonempty

mkdir "$OPENFILE"/test

if test -e "$OPENFILE"/test
then
rm -rf "$OPENFILE"/test
kdialog --caption "AcetoneISO" --error "Image was not mounted\nwww.acetoneiso.netsons.org/viewpage.php?page_id=4"
exit
fi

kfmclient openURL "$OPENFILE"
exit
