Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(115)

Side by Side Diff: host/image_to_live.sh

Issue 6873013: Add an option to specify an alternative NIC for image_to_live.sh (Closed) Base URL: http://git.chromium.org/git/dev-util.git@master
Patch Set: . Created 9 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 . $(dirname "$(readlink -f "$0")")/outside_chroot_common.sh || 8 . $(dirname "$(readlink -f "$0")")/outside_chroot_common.sh ||
9 SCRIPT_ROOT=/usr/lib/crosutils 9 SCRIPT_ROOT=/usr/lib/crosutils
10 10
11 . "${SCRIPT_ROOT}/common.sh" || 11 . "${SCRIPT_ROOT}/common.sh" ||
12 (echo "Unable to load common.sh" && false) || 12 (echo "Unable to load common.sh" && false) ||
13 exit 1 13 exit 1
14 14
15 . "${SCRIPT_ROOT}/remote_access.sh" || die "Unable to load remote_access.sh" 15 . "${SCRIPT_ROOT}/remote_access.sh" || die "Unable to load remote_access.sh"
16 16
17 # Flags to control image_to_live. 17 # Flags to control image_to_live.
18 DEFINE_boolean ignore_hostname ${FLAGS_TRUE} \ 18 DEFINE_boolean ignore_hostname ${FLAGS_TRUE} \
19 "Ignore existing AU hostname on running instance use this hostname." 19 "Ignore existing AU hostname on running instance use this hostname."
20 DEFINE_boolean ignore_version ${FLAGS_TRUE} \ 20 DEFINE_boolean ignore_version ${FLAGS_TRUE} \
21 "Ignore existing version on running instance and always update." 21 "Ignore existing version on running instance and always update."
22 DEFINE_string netdev "eth0" \
23 "The network device to use for figuring out hostname. \
24 This is useful on hosts with multiple NICs."
22 DEFINE_string server_log "dev_server.log" \ 25 DEFINE_string server_log "dev_server.log" \
23 "Path to log for the devserver." 26 "Path to log for the devserver."
24 DEFINE_boolean update "${FLAGS_TRUE}" \ 27 DEFINE_boolean update "${FLAGS_TRUE}" \
25 "Perform update of root partition." 28 "Perform update of root partition."
26 DEFINE_boolean update_known_hosts ${FLAGS_FALSE} \ 29 DEFINE_boolean update_known_hosts ${FLAGS_FALSE} \
27 "Update your known_hosts with the new remote instance's key." 30 "Update your known_hosts with the new remote instance's key."
28 DEFINE_string update_log "update_engine.log" \ 31 DEFINE_string update_log "update_engine.log" \
29 "Path to log for the update_engine." 32 "Path to log for the update_engine."
30 DEFINE_string update_url "" "Full url of an update image." 33 DEFINE_string update_url "" "Full url of an update image."
31 DEFINE_boolean verify ${FLAGS_TRUE} "Verify image on device after update." 34 DEFINE_boolean verify ${FLAGS_TRUE} "Verify image on device after update."
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
85 # some targets may have dns resolution issues trying to contact back 88 # some targets may have dns resolution issues trying to contact back
86 # to us. 89 # to us.
87 function get_hostname { 90 function get_hostname {
88 local hostname 91 local hostname
89 # Try to parse ifconfig for ip address. Use sudo, because not all distros 92 # Try to parse ifconfig for ip address. Use sudo, because not all distros
90 # allow a common user to call ifconfig. 93 # allow a common user to call ifconfig.
91 # TODO(zbehan): What if target is not connected via eth0? Update over wifi? 94 # TODO(zbehan): What if target is not connected via eth0? Update over wifi?
92 # Dedicated usb NIC? Perhaps this detection should be done in the target, 95 # Dedicated usb NIC? Perhaps this detection should be done in the target,
93 # which will get the return address in one way or another. Or maybe we should 96 # which will get the return address in one way or another. Or maybe we should
94 # just open a ssh tunnel and use localhost. 97 # just open a ssh tunnel and use localhost.
95 hostname=$(/sbin/ifconfig eth0 | 98 hostname=$(/sbin/ifconfig ${FLAGS_netdev} |
96 grep 'inet addr' | 99 grep 'inet addr' |
97 cut -f2 -d':' | 100 cut -f2 -d':' |
98 cut -f1 -d' ') 101 cut -f1 -d' ')
99 102
100 # Fallback to $HOSTNAME if that failed 103 # Fallback to $HOSTNAME if that failed
101 [ -z "${hostname}" ] && hostname=${HOSTNAME} 104 [ -z "${hostname}" ] && hostname=${HOSTNAME}
102 105
103 echo ${hostname} 106 echo ${hostname}
104 } 107 }
105 108
(...skipping 314 matching lines...) Expand 10 before | Expand all | Expand 10 after
420 local release_description=$(echo ${REMOTE_OUT} | cut -d '=' -f 2) 423 local release_description=$(echo ${REMOTE_OUT} | cut -d '=' -f 2)
421 info "Update was successful and rebooted to $release_description" 424 info "Update was successful and rebooted to $release_description"
422 fi 425 fi
423 426
424 print_time_elapsed 427 print_time_elapsed
425 428
426 exit 0 429 exit 0
427 } 430 }
428 431
429 main $@ 432 main $@
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698