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

Side by Side Diff: bin/cros_copy_upgrade_server.sh

Issue 3304013: Add client_prefix (string) and old_prefix (bool) command line options (Closed) Base URL: ssh://gitrw.chromium.org/crosutils.git
Patch Set: Tar up more utils Created 10 years, 3 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 | « 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/sh 1 #!/bin/sh
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 push the output of build_image.sh to a remote image server 7 # Script to push the output of build_image.sh to a remote image server
8 8
9 # TODO(pstew): Apparently the script files are in transition from 9 # TODO(pstew): Apparently the script files are in transition from
10 # src/scripts to src/scripts/bin. However this state has existed 10 # src/scripts to src/scripts/bin. However this state has existed
11 # for months now, therefore we need to look for the common libs in 11 # for months now, therefore we need to look for the common libs in
12 # both places 12 # both places
13 script_root=$(dirname $0) 13 script_root=$(dirname $0)
14 if [ -f ${script_root}/../common.sh ] ; then 14 if [ -f ${script_root}/../common.sh ] ; then
15 script_root=${script_root}/.. 15 script_root=${script_root}/..
16 fi 16 fi
17 17
18 . "${script_root}/common.sh" 18 . "${script_root}/common.sh"
19 19
20 # Flags 20 # Flags
21 DEFINE_string upgrade_server "" "SSH-capable host for upgrade server install" 21 DEFINE_string upgrade_server "" "SSH-capable host for upgrade server install"
22 DEFINE_string dest_path "" "Directory on host to do install" 22 DEFINE_string dest_path "" "Directory on host to do install"
23 DEFINE_string client_address "" "IP Address of netbook to update" 23 DEFINE_string client_address "" "IP Address of netbook to update"
24 DEFINE_string server_address "" "IP Address of upgrade server" 24 DEFINE_string server_address "" "IP Address of upgrade server"
25 DEFINE_string client_prefix "ChromeOSUpdateEngine" \
26 "client_prefix arg to devserver. Old version is MementoSoftwareUpdate"
27 DEFINE_boolean old_prefix ${FLAGS_FALSE} "Use old MementoSoftwareUpdate"
25 DEFINE_boolean start_server ${FLAGS_TRUE} "Start up the server" 28 DEFINE_boolean start_server ${FLAGS_TRUE} "Start up the server"
26 DEFINE_boolean stop_server ${FLAGS_FALSE} "Start up the server" 29 DEFINE_boolean stop_server ${FLAGS_FALSE} "Start up the server"
27 DEFINE_boolean no_copy_archive ${FLAGS_FALSE} "Skip copy of files to server" 30 DEFINE_boolean no_copy_archive ${FLAGS_FALSE} "Skip copy of files to server"
28 DEFINE_string from "" "Image directory to upload to server" 31 DEFINE_string from "" "Image directory to upload to server"
29 32
30 # Parse command line 33 # Parse command line
31 FLAGS "$@" || exit 1 34 FLAGS "$@" || exit 1
32 eval set -- "${FLAGS_ARGV}" 35 eval set -- "${FLAGS_ARGV}"
33 36
34 set -e 37 set -e
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after
67 70
68 echo "Creating dev server in ${FLAGS_upgrade_server}:${FLAGS_dest_path}..." 71 echo "Creating dev server in ${FLAGS_upgrade_server}:${FLAGS_dest_path}..."
69 72
70 require_upgrade_server 73 require_upgrade_server
71 # Create new empty directory to hold server components 74 # Create new empty directory to hold server components
72 ssh "${FLAGS_upgrade_server}" rm -rf "${FLAGS_dest_path}" || true 75 ssh "${FLAGS_upgrade_server}" rm -rf "${FLAGS_dest_path}" || true
73 ssh "${FLAGS_upgrade_server}" mkdir -p "${FLAGS_dest_path}/python" 76 ssh "${FLAGS_upgrade_server}" mkdir -p "${FLAGS_dest_path}/python"
74 77
75 # Copy server components into place 78 # Copy server components into place
76 (cd ${SCRIPTS_DIR}/../.. && \ 79 (cd ${SCRIPTS_DIR}/../.. && \
77 tar zcf - --exclude=.git --exclude=.svn \ 80 tar zcfh - --exclude=.git --exclude=.svn --exclude=pkgroot \
78 src/scripts/lib \ 81 src/scripts/lib \
79 src/scripts/start_devserver \ 82 src/scripts/start_devserver \
83 src/scripts/cros_generate_update_payload \
84 src/scripts/chromeos-common.sh \
80 src/scripts/{common,get_latest_image,mk_memento_images}.sh \ 85 src/scripts/{common,get_latest_image,mk_memento_images}.sh \
81 src/platform/dev) | \ 86 src/platform/dev) | \
82 ssh ${FLAGS_upgrade_server} "cd ${FLAGS_dest_path} && tar zxf -" 87 ssh ${FLAGS_upgrade_server} "cd ${FLAGS_dest_path} && tar zxf -"
83 88
84 # Copy Python web library into place out of the chroot 89 # Copy Python web library into place out of the chroot
85 (cd ${SCRIPTS_DIR}/../../chroot/usr/lib/python*/site-packages && \ 90 (cd ${SCRIPTS_DIR}/../../chroot/usr/lib/python*/site-packages && \
86 tar zcf - web*) | \ 91 tar zcf - web*) | \
87 ssh ${FLAGS_upgrade_server} "cd ${FLAGS_dest_path}/python && tar zxf -" 92 ssh ${FLAGS_upgrade_server} "cd ${FLAGS_dest_path}/python && tar zxf -"
88 } 93 }
89 94
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
131 echo "Server will be logging locally to $server_logfile" 136 echo "Server will be logging locally to $server_logfile"
132 137
133 # Find a TCP listen socket that is not in use 138 # Find a TCP listen socket that is not in use
134 ssh ${FLAGS_upgrade_server} "netstat -lnt" | awk '{ print $4 }' > $portlist 139 ssh ${FLAGS_upgrade_server} "netstat -lnt" | awk '{ print $4 }' > $portlist
135 server_port=8081 140 server_port=8081
136 while grep -q ":${server_port}$" $portlist; do 141 while grep -q ":${server_port}$" $portlist; do
137 server_port=$[server_port + 1] 142 server_port=$[server_port + 1]
138 done 143 done
139 rm -f $portlist 144 rm -f $portlist
140 145
141 ssh ${FLAGS_upgrade_server} "cd ${FLAGS_dest_path}/src/scripts && env PYTHONPA TH=${remote_root}${FLAGS_dest_path}/python CHROMEOS_BUILD_ROOT=${archive_dir} ./ start_devserver --archive_dir ${archive_dir} $server_port" > $server_logfile 2>& 1 & 146 if [ "${FLAGS_old_prefix}" -eq ${FLAGS_TRUE} ] ; then
147 FLAGS_client_prefix=MementoSoftwareUpdate
148 fi
149
150 ssh ${FLAGS_upgrade_server} "cd ${FLAGS_dest_path}/src/scripts && env PYTHONPA TH=${remote_root}${FLAGS_dest_path}/python CHROMEOS_BUILD_ROOT=${archive_dir} ./ start_devserver --archive_dir ${archive_dir} --client_prefix ${FLAGS_client_pref ix} $server_port" > $server_logfile 2>&1 &
Sam Leffler 2010/09/09 18:41:34 add a comment about fixed parameter ordering
142 server_pid=$! 151 server_pid=$!
143 152
144 trap server_cleanup 2 153 trap server_cleanup 2
145 154
146 # Wait for server to startup 155 # Wait for server to startup
147 while sleep 1; do 156 while sleep 1; do
148 if fgrep -q 'Serving images from' $server_logfile; then 157 if fgrep -q 'Serving images from' $server_logfile; then
149 echo "Server is ready" 158 echo "Server is ready"
150 break 159 break
151 elif kill -0 ${server_pid}; then 160 elif kill -0 ${server_pid}; then
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
205 echo "Running ${SCRIPTS_DIR}/image_to_live.sh $live_args" 214 echo "Running ${SCRIPTS_DIR}/image_to_live.sh $live_args"
206 ${SCRIPTS_DIR}/image_to_live.sh $live_args & 215 ${SCRIPTS_DIR}/image_to_live.sh $live_args &
207 else 216 else
208 echo "Start client upgrade using:" 217 echo "Start client upgrade using:"
209 echo " ${SCRIPTS_DIR}/image_to_live.sh ${live_args}<client_ip_address>" 218 echo " ${SCRIPTS_DIR}/image_to_live.sh ${live_args}<client_ip_address>"
210 fi 219 fi
211 220
212 wait ${server_pid} 221 wait ${server_pid}
213 fi 222 fi
214 223
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