#!/bin/bash
# Copyright 2013 Canonical Ltd.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU Lesser General Public License as published by
# the Free Software Foundation; version 2.1.
#
# 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 Lesser General Public License for more details.
#
# You should have received a copy of the GNU Lesser General Public License
# along with this program.  If not, see <http://www.gnu.org/licenses/>.
#
# Author: Juhapekka Piiroinen <juhapekka.piiroinen@canonical.com>

. `dirname $0`/functions.inc

FOLDERNAME=$2

set +e
echo "Lets create the click package for the project."
${SCRIPTPATH}/qtc_project_click_create ${FOLDERNAME} > /tmp/qtc_click_create.log

if [[ $? -eq 0 ]]; then
	set -e
	PACKAGENAME=`cat /tmp/qtc_click_create.log|tail -n1`
	echo "$PACKAGENAME has been created."
else
	cat /tmp/qtc_click_create.log
	exit -1
fi

echo "${SCRIPTPATH}/qtc_project_click_deploy"
${SCRIPTPATH}/qtc_project_click_deploy $1 ${PACKAGENAME} $3 $4 $5 $6



