#!/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

if [[ !does_device_hw_match_image_hw ]]; then
	IMAGE_HARDWARE=`device_image_hardware`
	DEVICE_HARDWARE=`device_hardware`
	echo
	echo " WARNING! Device image hardware version"
	echo "          does not match the detected device hardware."
	echo
	echo -n "          Device Image Version: "
	echo ${IMAGE_HARDWARE}
	echo -n "          Device Version: "
	echo ${DEVICE_HARDWARE}
 	echo
 	echo "          In order to flash your device, you must do it manually:"
 	echo "             ubuntu-device-flash --channel=devel-proposed --serial=${SERIALNUMBER} --bootstrap"
  	echo
else
	x-terminal-emulator -e "bash -ic 'ubuntu-device-flash --channel=devel-proposed --wipe --serial=${SERIALNUMBER} --bootstrap'"
fi
