5
BASEDIR=$(readlink -f $(dirname $0)/..)
7
# a simple script to ensure the proper image is installed on the target
9
[ -z $INSTALL_URL ] && echo "= INSTALL_URL not set. Using target as-is." && exit 0
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
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