Chromium Code Reviews| Index: image_to_live.sh |
| diff --git a/image_to_live.sh b/image_to_live.sh |
| index 79e15b1f35a62bb6038ac992bd846f1f00b61661..bd36b7fc62d7dd1bc1ec7b2eadd2d0492e43b3b3 100755 |
| --- a/image_to_live.sh |
| +++ b/image_to_live.sh |
| @@ -101,10 +101,18 @@ function remote_reboot_sh { |
| # to us. |
| function get_hostname { |
| local hostname |
| - # Try to parse ifconfig for ip address |
| - hostname=$(ifconfig eth0 \ |
| - | grep 'inet addr' \ |
| - | sed 's/.\+inet addr:\(\S\+\).\+/\1/') || hostname=${HOSTNAME} |
| + # Try to parse ifconfig for ip address. Use sudo, because not all distros |
| + # allow a common user to call ifconfig. |
| + # TODO(zbehan): What if target is not connected via eth0? Update over wifi? |
| + # 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=$(sudo ifconfig eth0 \ |
|
petkov
2011/02/16 23:37:54
fix per style -- if the pipe doesn't fit on one li
|
| + | grep 'inet addr' | cut -f2 -d':' |cut -f1 -d' ') |
| + |
| + # Fallback to $HOSTNAME if that failed |
| + [ -z "${hostname}" ] && hostname=$HOSTNAME |
|
petkov
2011/02/16 23:37:54
${HOSTNAME}
|
| + |
| echo ${hostname} |
| } |