Add an option to specify an alternative NIC for image_to_live.sh

Change-Id: Ic0367227ea87484f64b10e128e64143c371faa91

BUG=none
TEST=

Review URL: http://codereview.chromium.org/6873013
diff --git a/host/image_to_live.sh b/host/image_to_live.sh
index 9d0aa69..aeeb486 100755
--- a/host/image_to_live.sh
+++ b/host/image_to_live.sh
@@ -19,6 +19,9 @@
   "Ignore existing AU hostname on running instance use this hostname."
 DEFINE_boolean ignore_version ${FLAGS_TRUE} \
   "Ignore existing version on running instance and always update."
+DEFINE_string netdev "eth0" \
+  "The network device to use for figuring out hostname. \
+   This is useful on hosts with multiple NICs."
 DEFINE_string server_log "dev_server.log" \
   "Path to log for the devserver."
 DEFINE_boolean update "${FLAGS_TRUE}" \
@@ -92,7 +95,7 @@
   # Dedicated usb NIC? Perhaps this detection should be done in the target,
   # which will get the return address in one way or another. Or maybe we should
   # just open a ssh tunnel and use localhost.
-  hostname=$(/sbin/ifconfig eth0 |
+  hostname=$(/sbin/ifconfig ${FLAGS_netdev} |
       grep 'inet addr' |
       cut -f2 -d':' |
       cut -f1 -d' ')