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