← Back to team overview

curtin-dev team mailing list archive

[Merge] ~holmanb/curtin:master into curtin:master

 

Brett Holman has proposed merging ~holmanb/curtin:master into curtin:master.

Commit message:
support older versions of iproute2

Requested reviews:
  Michael Hudson-Doyle (mwhudson)

For more details, see:
https://code.launchpad.net/~holmanb/curtin/+git/curtin/+merge/433147

Bionic's iproute2 package contains a half-baked -json implementation; ip address and ip link work, while ip route simply accepts the flag but gives non-json output. This proposal works around that.

-- 
Your team curtin developers is subscribed to branch curtin:master.
diff --git a/tools/find-tgt b/tools/find-tgt
index e269beb..0a8bfd1 100755
--- a/tools/find-tgt
+++ b/tools/find-tgt
@@ -35,6 +35,8 @@ for r in json.load(sys.stdin):
   print(r["dev"])
   break
 ')
+    # on bionic, ip -json route show doesn't produce json
+    [ -n "$dev" ] || dev=$(ip route show | grep ^default | awk '{print $5}')
     [ -n "$dev" ] || { error "failed to find ipv4 device"; return 1; }
     addr=$(ip addr show dev "$dev" |
         awk '$1 == "inet" {gsub(/\/.*/,"", $2); print $2; exit}')

Follow ups