OLD | NEW |
1 #!/bin/sh | 1 #!/bin/sh |
2 | 2 |
3 # Load common constants. This should be the first executable line. | 3 # Load common constants. This should be the first executable line. |
4 # The path to common.sh should be relative to your script's location. | 4 # The path to common.sh should be relative to your script's location. |
5 . "$(dirname "$0")/common.sh" | 5 . "$(dirname "$0")/common.sh" |
6 | 6 |
7 # Flags | 7 # Flags |
8 DEFINE_string upgrade_server "" "SSH-capable host for upgrade server install" | 8 DEFINE_string upgrade_server "" "SSH-capable host for upgrade server install" |
9 DEFINE_string dest_path "" "Directory on host to do install" | 9 DEFINE_string dest_path "" "Directory on host to do install" |
10 DEFINE_string client_address "" "IP Address of netbook to update" | 10 DEFINE_string client_address "" "IP Address of netbook to update" |
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
111 start_server () { | 111 start_server () { |
112 require_upgrade_server | 112 require_upgrade_server |
113 echo "Starting remote devserver..." | 113 echo "Starting remote devserver..." |
114 server_logfile=/tmp/devserver_log.$$ | 114 server_logfile=/tmp/devserver_log.$$ |
115 portlist=/tmp/devserver_portlist.$$ | 115 portlist=/tmp/devserver_portlist.$$ |
116 echo "Server will be logging locally to $server_logfile" | 116 echo "Server will be logging locally to $server_logfile" |
117 | 117 |
118 # Find a TCP listen socket that is not in use | 118 # Find a TCP listen socket that is not in use |
119 ssh ${FLAGS_upgrade_server} "netstat -lnt" | awk '{ print $4 }' > $portlist | 119 ssh ${FLAGS_upgrade_server} "netstat -lnt" | awk '{ print $4 }' > $portlist |
120 server_port=8081 | 120 server_port=8081 |
121 while grep -q ":${port}$" $portlist; do | 121 while grep -q ":${server_port}$" $portlist; do |
122 server_port=$[server_port + 1] | 122 server_port=$[server_port + 1] |
123 done | 123 done |
124 rm -f $portlist | 124 rm -f $portlist |
125 | 125 |
126 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 & | 126 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 & |
127 server_pid=$! | 127 server_pid=$! |
128 | 128 |
129 trap server_cleanup 2 | 129 trap server_cleanup 2 |
130 | 130 |
131 # Wait for server to startup | 131 # Wait for server to startup |
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
186 fi | 186 fi |
187 live_args="--update_url=http://${FLAGS_server_address}:${server_port}/update
\ | 187 live_args="--update_url=http://${FLAGS_server_address}:${server_port}/update
\ |
188 --remote=${FLAGS_client_address}" | 188 --remote=${FLAGS_client_address}" |
189 echo "Running ${SCRIPTS_DIR}/image_to_live.sh $live_args" | 189 echo "Running ${SCRIPTS_DIR}/image_to_live.sh $live_args" |
190 ${SCRIPTS_DIR}/image_to_live.sh $live_args & | 190 ${SCRIPTS_DIR}/image_to_live.sh $live_args & |
191 fi | 191 fi |
192 | 192 |
193 wait ${server_pid} | 193 wait ${server_pid} |
194 fi | 194 fi |
195 | 195 |
OLD | NEW |