OLD | NEW |
1 #!/bin/bash | 1 #!/bin/bash |
2 | 2 |
3 # Copyright (c) 2009-2010 The Chromium OS Authors. All rights reserved. | 3 # Copyright (c) 2009-2010 The Chromium OS Authors. All rights reserved. |
4 # Use of this source code is governed by a BSD-style license that can be | 4 # Use of this source code is governed by a BSD-style license that can be |
5 # found in the LICENSE file. | 5 # found in the LICENSE file. |
6 | 6 |
7 # Script to update an image onto a live running ChromiumOS instance. | 7 # Script to update an image onto a live running ChromiumOS instance. |
8 | 8 |
9 # --- BEGIN COMMON.SH BOILERPLATE --- | 9 # --- BEGIN COMMON.SH BOILERPLATE --- |
10 # Load common CrOS utilities. Inside the chroot this file is installed in | 10 # Load common CrOS utilities. Inside the chroot this file is installed in |
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
100 # some targets may have dns resolution issues trying to contact back | 100 # some targets may have dns resolution issues trying to contact back |
101 # to us. | 101 # to us. |
102 function get_hostname { | 102 function get_hostname { |
103 local hostname | 103 local hostname |
104 # Try to parse ifconfig for ip address. Use sudo, because not all distros | 104 # Try to parse ifconfig for ip address. Use sudo, because not all distros |
105 # allow a common user to call ifconfig. | 105 # allow a common user to call ifconfig. |
106 # TODO(zbehan): What if target is not connected via eth0? Update over wifi? | 106 # TODO(zbehan): What if target is not connected via eth0? Update over wifi? |
107 # Dedicated usb NIC? Perhaps this detection should be done in the target, | 107 # Dedicated usb NIC? Perhaps this detection should be done in the target, |
108 # which will get the return address in one way or another. Or maybe we should | 108 # which will get the return address in one way or another. Or maybe we should |
109 # just open a ssh tunnel and use localhost. | 109 # just open a ssh tunnel and use localhost. |
110 hostname=$(sudo ifconfig eth0 | | 110 hostname=$(/sbin/ifconfig eth0 | |
111 grep 'inet addr' | | 111 grep 'inet addr' | |
112 cut -f2 -d':' | | 112 cut -f2 -d':' | |
113 cut -f1 -d' ') | 113 cut -f1 -d' ') |
114 | 114 |
115 # Fallback to $HOSTNAME if that failed | 115 # Fallback to $HOSTNAME if that failed |
116 [ -z "${hostname}" ] && hostname=${HOSTNAME} | 116 [ -z "${hostname}" ] && hostname=${HOSTNAME} |
117 | 117 |
118 echo ${hostname} | 118 echo ${hostname} |
119 } | 119 } |
120 | 120 |
(...skipping 317 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
438 local release_description=$(echo ${REMOTE_OUT} | cut -d '=' -f 2) | 438 local release_description=$(echo ${REMOTE_OUT} | cut -d '=' -f 2) |
439 info "Update was successful and rebooted to $release_description" | 439 info "Update was successful and rebooted to $release_description" |
440 fi | 440 fi |
441 | 441 |
442 print_time_elapsed | 442 print_time_elapsed |
443 | 443 |
444 exit 0 | 444 exit 0 |
445 } | 445 } |
446 | 446 |
447 main $@ | 447 main $@ |
OLD | NEW |