#!/bin/sh
#
#    Byobu - wrapper script for Mac OS X Application Launcher
#    Copyright (C) 2012-2014 Dustin Kirkland <kirkland@byobu.org>
#
#    Authors: Dustin Kirkland <kirkland@byobu.org>
#
#    This program is free software: you can redistribute it and/or modify
#    it under the terms of the GNU General Public License as published by
#    the Free Software Foundation, version 3 of the License.
#
#    This program is distributed in the hope that it will be useful,
#    but WITHOUT ANY WARRANTY; without even the implied warranty of
#    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
#    GNU General Public License for more details.
#
#    You should have received a copy of the GNU General Public License
#    along with this program.  If not, see <http://www.gnu.org/licenses/>.

set -e

if [ -x /Applications/iTerm.app/Contents/MacOS/iTerm ]; then
	if [ -x /usr/local/bin/byobu ]; then
		exec /Applications/iTerm.app/Contents/MacOS/iTerm /usr/local/bin/byobu
	else
		echo "You should install byobu into /usr/local" 1>&2
		echo "HINT: brew install byobu" 1>&2
		exit 1
	fi
else
	echo "You should install iTerm2 into your /Applications" 1>&2
		echo "HINT: http://www.iterm2.com" 1>&2
	exit 1
fi
