#!/bin/bash

if [[ "$DISPLAY" && "$(which Xdialog 2>&1 | grep -v "which: no")" ]]; then
	dialog="Xdialog"
else
	dialog="dialog"
fi

if [ ! -e "$1" ]; then
	$dialog --title "Mount What??" --msgbox "\nIf you passed a path to an iso, it seems to be incorrect.\n" 0 0
	exit
fi
xx=`file "$1" | grep filesystem`
if [[ -z "$xx" ]]; then
	$dialog --title "Not an ISO file?" --msgbox "\n$1\nDoes not appear to be a valid iso file\n" 0 0
	exit
fi
isoNAME=$(basename "$1")
mkdir "/tmp/$isoNAME.mount"
fuseiso "$1" "/tmp/$isoNAME.mount"
arox "/tmp/$isoNAME.mount"
exit 0

