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

Side by Side Diff: src/scripts/image_to_live.sh

Issue 1967002: Adjust image_to_live's devserver flags to work around lab network port restrictions. (Closed) Base URL: ssh://git@chromiumos-git//chromeos
Patch Set: fix killall_devserver Created 10 years, 7 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
« no previous file with comments | « src/platform/dev/devserver.py ('k') | 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 The Chromium OS Authors. All rights reserved. 3 # Copyright (c) 2009 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 # Load common constants. This should be the first executable line. 9 # Load common constants. This should be the first executable line.
10 # The path to common.sh should be relative to your script's location. 10 # The path to common.sh should be relative to your script's location.
11 11
12 . "$(dirname $0)/common.sh" 12 . "$(dirname $0)/common.sh"
13 . "$(dirname $0)/remote_access.sh" 13 . "$(dirname $0)/remote_access.sh"
14 14
15 DEFINE_boolean ignore_version ${FLAGS_TRUE} \ 15 DEFINE_boolean ignore_version ${FLAGS_TRUE} \
16 "Ignore existing version on running instance and always update" 16 "Ignore existing version on running instance and always update"
17 DEFINE_boolean ignore_hostname ${FLAGS_TRUE} \ 17 DEFINE_boolean ignore_hostname ${FLAGS_TRUE} \
18 "Ignore existing AU hostname on running instance use this hostname" 18 "Ignore existing AU hostname on running instance use this hostname"
19 DEFINE_boolean update_known_hosts ${FLAGS_FALSE} \ 19 DEFINE_boolean update_known_hosts ${FLAGS_FALSE} \
20 "Update your known_hosts with the new remote instance's key" 20 "Update your known_hosts with the new remote instance's key"
21 DEFINE_boolean verbose ${FLAGS_FALSE} \ 21 DEFINE_boolean verbose ${FLAGS_FALSE} \
22 "Whether to output verbose information for debugging." 22 "Whether to output verbose information for debugging."
23 DEFINE_integer devserver_port 8080 \
24 "Port to use for devserver"
23 25
24 function kill_all_devservers { 26 function kill_all_devservers {
25 # Using ! here to avoid exiting with set -e is insufficient, so use 27 # Using ! here to avoid exiting with set -e is insufficient, so use
26 # || true instead. 28 # || true instead.
27 pkill -fx ".*devserver\.py" || true 29 sudo pkill -f devserver\.py || true
28 } 30 }
29 31
30 function cleanup { 32 function cleanup {
31 echo "Killing dev server." 33 echo "Killing dev server."
32 kill_all_devservers 34 kill_all_devservers
33 cleanup_remote_access 35 cleanup_remote_access
34 rm -rf "${TMP}" 36 rm -rf "${TMP}"
35 } 37 }
36 38
37 function remote_reboot_sh { 39 function remote_reboot_sh {
38 rm -f "${TMP_KNOWN_HOSTS}" 40 rm -f "${TMP_KNOWN_HOSTS}"
39 remote_sh "$@" 41 remote_sh "$@"
40 } 42 }
41 43
42 function start_dev_server { 44 function start_dev_server {
43 kill_all_devservers 45 kill_all_devservers
44 if [ ${FLAGS_verbose} -eq ${FLAGS_FALSE} ]; then 46 if [ ${FLAGS_verbose} -eq ${FLAGS_FALSE} ]; then
45 ./enter_chroot.sh "./start_devserver > dev_server.log 2>&1" & 47 ./enter_chroot.sh "sudo ./start_devserver ${FLAGS_devserver_port} \
48 > dev_server.log 2>&1" &
46 else 49 else
47 ./enter_chroot.sh "./start_devserver" & 50 ./enter_chroot.sh "sudo ./start_devserver ${FLAGS_devserver_port}" &
48 fi 51 fi
49 echo -n "Waiting on devserver to start" 52 echo -n "Waiting on devserver to start"
50 until netstat -anp 2>&1 | grep 8080 > /dev/null; do 53 until netstat -anp 2>&1 | grep ${FLAGS_devserver_port} > /dev/null; do
51 sleep .5 54 sleep .5
52 echo -n "." 55 echo -n "."
53 done 56 done
54 echo "" 57 echo ""
55 } 58 }
56 59
57 # Copys stateful update script which fetches the newest stateful update 60 # Copys stateful update script which fetches the newest stateful update
58 # from the dev server and prepares the update. chromeos_startup finishes 61 # from the dev server and prepares the update. chromeos_startup finishes
59 # the update on next boot. 62 # the update on next boot.
60 function copy_stateful_update { 63 function copy_stateful_update {
(...skipping 10 matching lines...) Expand all
71 74
72 if [[ ${FLAGS_ignore_version} -eq ${FLAGS_TRUE} ]]; then 75 if [[ ${FLAGS_ignore_version} -eq ${FLAGS_TRUE} ]]; then
73 echo "Forcing update independent of the current version" 76 echo "Forcing update independent of the current version"
74 remote_sh "cat /etc/lsb-release |\ 77 remote_sh "cat /etc/lsb-release |\
75 grep -v CHROMEOS_RELEASE_VERSION > /etc/lsb-release~;\ 78 grep -v CHROMEOS_RELEASE_VERSION > /etc/lsb-release~;\
76 mv /etc/lsb-release~ /etc/lsb-release; \ 79 mv /etc/lsb-release~ /etc/lsb-release; \
77 echo 'CHROMEOS_RELEASE_VERSION=0.0.0.0' >> /etc/lsb-release" 80 echo 'CHROMEOS_RELEASE_VERSION=0.0.0.0' >> /etc/lsb-release"
78 fi 81 fi
79 82
80 if [ ${FLAGS_ignore_hostname} -eq ${FLAGS_TRUE} ]; then 83 if [ ${FLAGS_ignore_hostname} -eq ${FLAGS_TRUE} ]; then
81 echo "Forcing update from ${HOSTNAME}" 84 devserver_url="http://$HOSTNAME:${FLAGS_devserver_port}"
85 echo "Forcing update from ${devserver_url}"
82 remote_sh "cat /etc/lsb-release |\ 86 remote_sh "cat /etc/lsb-release |\
83 grep -v '^CHROMEOS_AUSERVER=' |\ 87 grep -v '^CHROMEOS_AUSERVER=' |\
84 grep -v '^CHROMEOS_DEVSERVER=' > /etc/lsb-release~;\ 88 grep -v '^CHROMEOS_DEVSERVER=' > /etc/lsb-release~;\
85 mv /etc/lsb-release~ /etc/lsb-release; \ 89 mv /etc/lsb-release~ /etc/lsb-release; \
86 echo 'CHROMEOS_AUSERVER=http://$HOSTNAME:8080/update' >> \ 90 echo 'CHROMEOS_AUSERVER=${devserver_url}/update' >> \
87 /etc/lsb-release; \ 91 /etc/lsb-release; \
88 echo 'CHROMEOS_DEVSERVER=http://$HOSTNAME:8080' >> /etc/lsb-release" 92 echo 'CHROMEOS_DEVSERVER=${devserver_url}' >> /etc/lsb-release"
89 fi 93 fi
90 } 94 }
91 95
92 function run_auto_update { 96 function run_auto_update {
93 echo "Starting update" 97 echo "Starting update"
94 local update_file=/var/log/softwareupdate.log 98 local update_file=/var/log/softwareupdate.log
95 # Clear it out so we don't see a prior run and make sure it 99 # Clear it out so we don't see a prior run and make sure it
96 # exists so the first tail below can't fail if it races the 100 # exists so the first tail below can't fail if it races the
97 # memento updater first write and wins. 101 # memento updater first write and wins.
98 remote_sh "rm -f ${update_file}; touch ${update_file}; \ 102 remote_sh "rm -f ${update_file}; touch ${update_file}; \
(...skipping 108 matching lines...) Expand 10 before | Expand all | Expand 10 after
207 fi 211 fi
208 212
209 remote_sh "grep ^CHROMEOS_RELEASE_DESCRIPTION= /etc/lsb-release" 213 remote_sh "grep ^CHROMEOS_RELEASE_DESCRIPTION= /etc/lsb-release"
210 local release_description=$(echo $REMOTE_OUT | cut -d '=' -f 2) 214 local release_description=$(echo $REMOTE_OUT | cut -d '=' -f 2)
211 echo "Update was successful and rebooted to $release_description" 215 echo "Update was successful and rebooted to $release_description"
212 216
213 return 0 217 return 0
214 } 218 }
215 219
216 main $@ 220 main $@
OLDNEW
« no previous file with comments | « src/platform/dev/devserver.py ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698