Merge lp:~sergiusens/phablet-tools/1175806 into lp:phablet-tools

Proposed by Sergio Schvezov
Status: Merged
Approved by: Alan Pope 🍺🐧🐱 πŸ¦„
Approved revision: 92
Merged at revision: 90
Proposed branch: lp:~sergiusens/phablet-tools/1175806
Merge into: lp:phablet-tools
Diff against target: 61 lines (+26/-10)
2 files modified
debian/changelog (+6/-0)
phablet-network-setup (+20/-10)
To merge this branch: bzr merge lp:~sergiusens/phablet-tools/1175806
Reviewer Review Type Date Requested Status
Alan Pope 🍺🐧🐱 πŸ¦„ (community) Approve
PS Jenkins bot continuous-integration Approve
Review via email: mp+163212@code.launchpad.net

Commit message

Waiting for an IP to be available before continuing with package install

Description of the change

We are now waiting for an IP before trying to update the package cache.

To test, make sure you have no connection on your device and run
./phablet-network-setup -i

Ideally you'd either get a timeout or no errors when updating.

To post a comment you must log in.
Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Approve (continuous-integration)
Revision history for this message
Alan Pope 🍺🐧🐱 πŸ¦„ (popey) wrote :

I don't think it waits long enough. I ran it and the loop finished _just_ before the wifi finished connecting.

alan@deep-thought:/tmp/1175806$ ./phablet-network-setup -i
[sudo] password for alan:
Network file is /etc/NetworkManager/system-connections/popey
Provisioning network file to device
restarting adbd as root
6 KB/s (284 bytes in 0.043s)

Network setup complete
Installing ssh
Network not ready, sleeping
Network not ready, sleeping
Network not ready, sleeping
alan@deep-thought:/tmp/1175806$

lp:~sergiusens/phablet-tools/1175806 updated
91. By Sergio Schvezov

Adding packaging information

92. By Sergio Schvezov

Removing set -e and making the timeout longer

Revision history for this message
Paul Larson (pwlars) wrote :

Works on my mako, +1

Revision history for this message
PS Jenkins bot (ps-jenkins) wrote :
review: Approve (continuous-integration)
Revision history for this message
Alan Pope 🍺🐧🐱 πŸ¦„ (popey) wrote :

Works nicely on a freshly flashed nexus 7

review: Approve

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== modified file 'debian/changelog'
2--- debian/changelog 2013-05-07 00:01:02 +0000
3+++ debian/changelog 2013-05-09 20:54:26 +0000
4@@ -1,3 +1,9 @@
5+phablet-tools (0.13-0ubuntu1) UNRELEASED; urgency=low
6+
7+ * phablet-network-setup: adding wait before refreshing packagnig cache.
8+
9+ -- Sergio Schvezov <sergio.schvezov@canonical.com> Thu, 09 May 2013 17:48:07 -0300
10+
11 phablet-tools (0.12daily13.05.07ubuntu.unity.next-0ubuntu1) raring; urgency=low
12
13 * Automatic snapshot from revision 88 (ubuntu-unity/next)
14
15=== modified file 'phablet-network-setup'
16--- phablet-network-setup 2013-04-15 18:24:25 +0000
17+++ phablet-network-setup 2013-05-09 20:54:26 +0000
18@@ -14,8 +14,6 @@
19 #
20 # Copyright (C) 2012 Canonical, Ltd.
21
22-set -e
23-
24 export LC_ALL=C
25
26 usage() {
27@@ -131,14 +129,26 @@
28 EOF
29
30 echo Installing ssh
31- wait=0
32- command=$(adb $ADBOPTS shell chroot /data/ubuntu /usr/bin/nmcli -t -f name,devices,vpn con status)
33- until [ -n "$command" ] || [ $wait -eq 4 ]; do
34- echo "Network not ready, sleeping"
35- command=$(adb $ADBOPTS shell chroot /data/ubuntu /usr/bin/nmcli -t -f name,devices,vpn con status)
36- sleep $(( wait++ ))
37- done
38- if [ -z "$command" ]; then
39+ nmcli_cmd="adb $ADBOPTS shell chroot /data/ubuntu /usr/bin/nmcli"
40+ wait=0
41+ iface=$($nmcli_cmd -t -f devices con status | tr -d '\r')
42+ until [ -n "$iface" ] || [ $wait -eq 10 ]; do
43+ echo "Network not ready, sleeping"
44+ iface=$($nmcli_cmd -t -f devices con status | tr -d '\r')
45+ sleep $(( wait++ ))
46+ done
47+ if [ -z "$iface" ]; then
48+ echo "Network setup timed out"
49+ exit 1
50+ fi
51+ wait=0
52+ ip_data=$($nmcli_cmd -t dev list iface $iface | grep ADDRESS)
53+ until [ -n "$ip_data" ] || [ $wait -eq 10 ]; do
54+ echo "Network not ready, sleeping"
55+ ip_data=$($nmcli_cmd -t dev list iface $iface | grep ADDRESS)
56+ sleep $(( wait++ ))
57+ done
58+ if [ -z "$ip_data" ]; then
59 echo "Network setup timed out"
60 exit 1
61 fi

Subscribers

People subscribed via source and target branches