diff options
author | Po-Hsu Lin <po-hsu.lin@canonical.com> | 2016-04-11 11:45:22 +0800 |
---|---|---|
committer | Po-Hsu Lin <po-hsu.lin@canonical.com> | 2016-04-11 11:45:22 +0800 |
commit | a8f2e1d0afeb0bad1bd52dc8d86931e27a2a6607 (patch) | |
tree | 434f24a662aac8971bd784b6b02e8821405741fb /jobs | |
parent | 6a99ace571fd22bab033b030dab3aed45eba8211 (diff) |
p-p-c: use multiline output from nmcli to get the correct interface.
Use grep and sed to get the gsm nmcli output sector, and get the correct interface. It should be more reliable than just cutting the nth field.
Diffstat (limited to 'jobs')
-rw-r--r-- | jobs/mobilebroadband.txt.in | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/jobs/mobilebroadband.txt.in b/jobs/mobilebroadband.txt.in index 0f1abb7..d2a8d08 100644 --- a/jobs/mobilebroadband.txt.in +++ b/jobs/mobilebroadband.txt.in @@ -17,7 +17,7 @@ command: `[ -n "${GSM_USERNAME}" ] && echo "--username=$GSM_USERNAME"` \ `[ -n "${GSM_PASSWORD}" ] && echo "--password=$GSM_PASSWORD"` || exit 1 fi - INTERFACE=`(nmcli -t -f GENERAL -m tabular dev list 2>/dev/null || nmcli -t -f GENERAL -m tabular dev show) |grep gsm |cut -d ":" -f 2` + INTERFACE=`(nmcli -f GENERAL -t dev list 2>/dev/null || nmcli -f GENERAL -t dev show) | tr '\n' ' ' | grep -oP 'TYPE:\Kgsm.*' | sed 's/GENERAL.TYPE:.*//' | grep -oP 'GENERAL.IP-IFACE:\K\S*'` echo "connected GSM interface seems to be $INTERFACE" [ -z $INTERFACE ] && exit 1 curl http://start.ubuntu.com/connectivity-check.html --interface $INTERFACE @@ -46,7 +46,7 @@ command: `[ -n "${CDMA_USERNAME}" ] && echo "--username=$CDMA_USERNAME"` \ `[ -n "${CDMA_PASSWORD}" ] && echo "--password=$CDMA_PASSWORD"` || exit 1 fi - INTERFACE=`(nmcli -t -f GENERAL -m tabular dev list 2>/dev/null || nmcli -t -f GENERAL -m tabular dev show) |grep cdma |cut -d ":" -f 2` + INTERFACE=`(nmcli -f GENERAL -t dev list 2>/dev/null || nmcli -f GENERAL -t dev show) | tr '\n' ' ' | grep -oP 'TYPE:\Kcdma.*' | sed 's/GENERAL.TYPE:.*//' | grep -oP 'GENERAL.IP-IFACE:\K\S*'` echo "connected CDMA interface seems to be $INTERFACE" [ -z $INTERFACE ] && exit 1 curl http://start.ubuntu.com/connectivity-check.html --interface $INTERFACE |