#!/bin/sh
# This script is a part of prewebenv.
# It is released without any kind of warranty.
# Copyright (C) 2012 Marcin Mielniczuk

# 0 - OK
# 1 - Mojo missing
# 2 - Easy Debian missing
# 3 - no arguments

PREWEBENV_ROOT=/opt/prewebenv
CHECK=`$PREWEBENV_ROOT/check.sh`

if [ "$#" == "0" ]
then
	echo "No arguments given..."
	echo "Exiting..."
	exit 3
fi

if [ "$CHECK" == "1" ]
then
	echo "Error: Mojo framework not present..."
	echo "Exiting..."
	exit 1
fi

if [ "$CHECK" == "2" ] 
then
	echo "Error: Easy Debian image not present..."
	if [ "`mount | grep /home/user/MyDocs`" == "" ] # checking if mounted
	then
		echo "Internal storage not mounted..."
	fi
	echo "Exiting..."
	exit 2
fi

exec debbie chromium-browser --disable-web-security --app=file://$@
