@@ -4,7 +4,7 @@
4# Our goal here is to get an Ubuntu Touch device into a testable unlocked state.
4# Our goal here is to get an Ubuntu Touch device into a testable unlocked state.
5# This will include a reboot.
5# This will include a reboot.
7−WAIT_COMMAND="adb reboot; sleep 5; adb wait-for-device"
7+WAIT_COMMAND="adb reboot; sleep 5; adb wait-for-device; sleep 20"
9while getopts s:w: opt; do
9while getopts s:w: opt; do
10 case $opt in
10 case $opt in
@@ -19,16 +19,17 @@ done
20eval "$WAIT_COMMAND"
20eval "$WAIT_COMMAND"
22−# Force a sleep no matter what, since we may need to wait for unity8
22+for i in `seq 1 5`; do
23−# to finish coming up (it's hard to tell when the greeter is actually rendered)
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"
29+ echo "I: Unlock attempt $i failed, script output: '$UNLOCK_OUTPUT'"
26−# We need to go through sudo to get a proper environment for dbus set up
34+echo "I: Too many unlock failures, giving up"
27−UNLOCK_OUTPUT=$(adb shell "gdbus call --session --dest com.canonical.UnityGreeter --object-path / --method com.canonical.UnityGreeter.HideGreeter && echo Greeter unlocked" 2>&1)
28−if echo "$UNLOCK_OUTPUT" | grep 'Greeter unlocked' >/dev/null; then
29− echo "I: Unlock passed"
32− echo "I: Unlock failed, script output: '$UNLOCK_OUTPUT'"