#!/bin/bash

if test ! -e /usr/bin/fuseiso
then
	if test ! -e /usr/local/bin/fuseiso
		then
		kdialog --caption "AcetoneISO2" --error "Please launch AcetoneISO2 and run 'compatibility'"
		exit
		else
		echo continua
		fi
else
echo continua
fi

mkdir $HOME/virtual-drives/
mkdir /tmp/acetoneiso2/

rm -rf $HOME/virtual-drives/tmp
mkdir $HOME/virtual-drives/tmp


if test ! -e /tmp/acetoneiso2/1
then
> $HOME/virtual-drives/tmp/1
/usr/share/acetoneiso2/bin/sm/iso2
else
	if test ! -e /tmp/acetoneiso2/2
	then
	> $HOME/virtual-drives/tmp/2
	/usr/share/acetoneiso2/bin/sm/iso2
	else
			if test ! -e /tmp/acetoneiso2/3
			then
			> $HOME/virtual-drives/tmp/3
			/usr/share/acetoneiso2/bin/sm/iso2
			else
					if test ! -e /tmp/acetoneiso2/4
					then
					> $HOME/virtual-drives/tmp/4
					/usr/share/acetoneiso2/bin/sm/iso2
					else
						if test ! -e /tmp/acetoneiso2/5
						then
						> $HOME/virtual-drives/tmp/5
						/usr/share/acetoneiso2/bin/sm/iso2
						else
							if test ! -e /tmp/acetoneiso2/6
							then
							> $HOME/virtual-drives/tmp/6
							/usr/share/acetoneiso2/bin/sm/iso2
							else
								if test ! -e /tmp/acetoneiso2/7
								then
								> $HOME/virtual-drives/tmp/7
								/usr/share/acetoneiso2/bin/sm/iso2
								else
								kdialog --caption "AcetoneISO2" --sorry "All drives are mounted. Please umount at least one from the main program"
								fi
							fi
						fi
					fi
			fi
	fi
fi
