Home | History | Annotate | Download | only in firmware_TouchMTB
      1 #!/bin/sh
      2 
      3 # Copyright (c) 2014 The Chromium OS Authors. All rights reserved.
      4 # Use of this source code is governed by a BSD-style license that can be
      5 # found in the LICENSE file.
      6 
      7 # Read command flags
      8 . /usr/share/misc/shflags
      9 DEFINE_string "remote" "" "remote machine IP address" "r"
     10 
     11 PROG=$0
     12 FLAGS_HELP=\
     13 "USAGE: $PROG [flags]
     14 
     15 Examples:
     16   # Generate the version info and scp it to the IP address.
     17   $ $PROG -r 100.20.300.123
     18 "
     19 
     20 FLAGS "$@" || exit 1
     21 eval set -- "${FLAGS_ARGV}"
     22 set -e
     23 
     24 
     25 PROJ="firmware_TouchMTB"
     26 TEST_DIR="/usr/local/autotest/tests/${PROJ}"
     27 VERSION_FILE="/tmp/.version"
     28 
     29 # Print an error message and exit.
     30 die() {
     31   echo "$@" > /dev/stderr
     32   exit 1
     33 }
     34 
     35 if [ -z ${FLAGS_remote} ]; then
     36   die "Error: you need to provide the IP address of the test machine."
     37 fi
     38 
     39 create_version="`dirname $PROG`"/tools/create_version.py
     40 if ! $create_version "$VERSION_FILE"; then
     41   die "Error: failed to create version info"
     42 fi
     43 
     44 expect_scp="`dirname $PROG`"/tools/expect_scp
     45 if ! $expect_scp "root@${FLAGS_remote}:${TEST_DIR}" "$VERSION_FILE"; then
     46   die "Error: scp version file $VERSION_FILE to ${FLAGS_remote}:${TEST_DIR}"
     47 fi
     48 
     49 rm -fr "$VERSION_FILE"
     50