From b8a8af507e12a39d90215c7b53263d0213ce4b62 Mon Sep 17 00:00:00 2001 From: Andreas Oberritter Date: Wed, 23 Dec 2015 01:27:56 +0100 Subject: [PATCH] connman: nfsroot: support multiple IPs, use link status --- .../connman/connman/connmand-env | 29 ++++++++++--------- 1 file changed, 16 insertions(+), 13 deletions(-) diff --git a/meta-opendreambox/recipes-connectivity/connman/connman/connmand-env b/meta-opendreambox/recipes-connectivity/connman/connman/connmand-env index e29711ed..fd4c676c 100755 --- a/meta-opendreambox/recipes-connectivity/connman/connman/connmand-env +++ b/meta-opendreambox/recipes-connectivity/connman/connman/connmand-env @@ -28,20 +28,23 @@ done options= if [ "$root" = "/dev/nfs" -o -n "$nfsroot" -a -n "$ip" ]; then - set -- $(ip -4 -o addr show | awk '{print $2}' | grep -v '^lo$') + set -- $(ip -4 -o addr show | awk '{print $2}') for dev do - case "$ip" in - any|bootp|both|dhcp|on|rarp) - options="-I $dev $options" - ;; - *) - dev_addr=`ip -4 -o addr show $dev | awk '{print $4}' | grep -o '^[0-9.]\+'` - if [ "$ip" = "$dev_addr" ]; then - options="-I $dev" - break - fi - ;; - esac + if ip -o link show $dev | awk '{print $3}' | grep -qvw -e 'LOOPBACK' -e 'NO-CARRIER'; then + case "$ip" in + any|bootp|both|dhcp|on|rarp) + options="-I $dev $options" + ;; + *) + for dev_addr in $(ip -4 -o addr show dev $dev | awk '{print $4}' | grep -o '^[0-9.]\+'); do + if [ "$ip" = "$dev_addr" ]; then + options="-I $dev" + break + fi + done + ;; + esac + fi done fi -- 2.20.1