#!/bin/bash
username=$(whoami)
processed_template_location=$(mktemp -d -t firefox-sandbox)
DIR=`pwd`
sed -e "s/%%username%%/${username}/g" -e "s=%%PATH%%=${processed_template_location}/=g" ${DIR}/firefox-profile.sb > ${processed_template_location}/firefox-profile.sb
sed -e "s/%%username%%/${username}/g" ${DIR}/flashplugin.sb > ${processed_template_location}/flashplugin.sb
sed -e "s/%%username%%/${username}/g" ${DIR}/javaplugin.sb > ${processed_template_location}/javaplugin.sb
sed -e "s/%%username%%/${username}/g" ${DIR}/kerberos.sb > ${processed_template_location}/kerberos.sb
sed -e "s/%%username%%/${username}/g" ${DIR}/1passwd.sb > ${processed_template_location}/1passwd.sb

cd ${processed_template_location}

/usr/bin/sandbox-exec -f "${processed_template_location}/firefox-profile.sb" "/usr/bin/basename" &> /dev/null
#/usr/bin/sandbox-exec -f "${processed_template_location}/firefox-profile.sb" "/Applications/Firefox.app/Contents/MacOS/firefox-bin" 
/usr/bin/sandbox-exec -f "${processed_template_location}/firefox-profile.sb" "/Applications/IronFox.app/Contents/Resources/IronFox.app/Contents/MacOS/firefox-bin" &>/dev/null

