on 8.02+15.04.20150216.1-0ubuntu1 help sign in
unity8/tools/unlock-device
35 lines 1.0 kB history raw
1#!/bin/bash
2# -*- Mode: sh; indent-tabs-mode: nil; tab-width: 4 -*-
4# Our goal here is to get an Ubuntu Touch device into a testable unlocked state.
5# This will include a reboot.
7WAIT_COMMAND="adb reboot; sleep 5; adb wait-for-device; sleep 20"
9while getopts s:w: opt; do
10 case $opt in
11 s)
12 export ANDROID_SERIAL=$OPTARG
13 ;;
14 w)
15 WAIT_COMMAND=$OPTARG
16 ;;
17 esac
18done
20eval "$WAIT_COMMAND"
22for i in `seq 1 5`; do
23 # We need to go through sudo to get a proper environment for dbus set up
24 UNLOCK_OUTPUT=$(adb shell "gdbus call --session --dest com.canonical.UnityGreeter --object-path / --method com.canonical.UnityGreeter.HideGreeter && echo Greeter unlocked" 2>&1)
25 if echo "$UNLOCK_OUTPUT" | grep 'Greeter unlocked' >/dev/null; then
26 echo "I: Unlock passed"
27 exit 0
28 else
29 echo "I: Unlock attempt $i failed, script output: '$UNLOCK_OUTPUT'"
30 sleep 20
31 fi
32done
34echo "I: Too many unlock failures, giving up"
35exit 1