~pwlars/ubuntu-test-cases/krillin-recovery

« back to all changes in this revision

Viewing changes to scripts/assert-image

  • Committer: Andy Doan
  • Date: 2013-09-10 12:58:02 UTC
  • mto: (19.1.2 touch)
  • mto: This revision was merged to the branch mainline in revision 20.
  • Revision ID: andy.doan@canonical.com-20130910125802-1qbsilf5j386bt0n
remove hard-coding of the branch

this makes it easier to test changes locally

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
#!/bin/sh
2
 
 
3
 
set -e
4
 
 
5
 
BASEDIR=$(readlink -f $(dirname $0)/..)
6
 
 
7
 
# a simple script to ensure the proper image is installed on the target
8
 
 
9
 
[ -z $INSTALL_URL ] && echo "= INSTALL_URL not set. Using target as-is." && exit 0
10
 
 
11
 
echo "Ensuring target has proper image..."
12
 
REQUIRED_UUID=$(curl ${INSTALL_URL}/artifact/clientlogs/.ci-uuid)
13
 
ACTUAL_UUID=$(adb shell "cat /home/phablet/.ci-uuid | tr -d '\r\n'")
14
 
if [ "$REQUIRED_UUID" != "$ACTUAL_UUID" ] ; then
15
 
        echo "= UUIDs $REQUIRED_UUID != $ACTUAL_UUID"
16
 
        ARGS=$(curl ${INSTALL_URL}/artifact/clientlogs/.ci-flash-args | tr -d '\r\n')
17
 
        CUST=$(curl ${INSTALL_URL}/artifact/clientlogs/.ci-customizations | tr -d '\r\n')
18
 
        echo "reprovisioning device with: $ARGS"
19
 
        echo "customizing device with: $CUST"
20
 
        #Make the image writable if we reprovision by adding a space
21
 
        #after to CUSTOMIZE so it is never empty
22
 
        UUID=$REQUIRED_UUID IMAGE_OPT=$ARGS CUSTOMIZE="$CUST " \
23
 
                ${BASEDIR}/scripts/provision.sh
24
 
else
25
 
        echo "= UUIDS match, reusing image on target"
26
 
        echo $REQUIRED_UUID > clientlogs/.ci-uuid
27
 
        curl ${INSTALL_URL}/artifact/clientlogs/.ci-flash-args > clientlogs/.ci-flash-args
28
 
        curl ${INSTALL_URL}/artifact/clientlogs/.ci-customizations > clientlogs/.ci-customizations
29
 
fi
30