mirror of
https://github.com/flatcar/scripts.git
synced 2025-08-10 06:26:57 +02:00
Clean up command line arguments and user output
Clean up command-line argument used to disable re-download of image bits down to the upgrade server. This is now handed via a much more concise "--no_copy_archive" argument. and user output output "fast restart" messages Output information on how to run the "image_to_live.sh" client unconditionally (even if a client isn't being launched by this instance). BUG=none TEST=Reran commands, observed output Review URL: http://codereview.chromium.org/2919009
This commit is contained in:
parent
bd2871a43a
commit
b3f323ed73
@ -11,6 +11,7 @@ DEFINE_string client_address "" "IP Address of netbook to update"
|
||||
DEFINE_string server_address "" "IP Address of upgrade server"
|
||||
DEFINE_boolean start_server ${FLAGS_TRUE} "Start up the server"
|
||||
DEFINE_boolean stop_server ${FLAGS_FALSE} "Start up the server"
|
||||
DEFINE_boolean no_copy_archive ${FLAGS_FALSE} "Skip copy of files to server"
|
||||
DEFINE_string from "" "Image directory to upload to server"
|
||||
|
||||
# Parse command line
|
||||
@ -103,7 +104,7 @@ create_archive_dir () {
|
||||
stop_server () {
|
||||
require_upgrade_server
|
||||
echo "Stopping remote devserver..."
|
||||
echo "(Fast restart using \"$0 --upgrade_server=${FLAGS_upgrade_server} --dest_path=${FLAGS_dest_path} --archive_dir=${archive_dir}\")"
|
||||
echo "(Fast restart using \"$0 --upgrade_server=${FLAGS_upgrade_server} --dest_path=${FLAGS_dest_path} --no_copy_archive\")"
|
||||
ssh ${FLAGS_upgrade_server} pkill -f ${archive_dir} || /bin/true
|
||||
}
|
||||
|
||||
@ -160,7 +161,8 @@ else
|
||||
validate_devserver_path
|
||||
fi
|
||||
|
||||
if [ ${FLAGS_stop_server} -eq ${FLAGS_FALSE} ] ; then
|
||||
if [ ${FLAGS_stop_server} -eq ${FLAGS_FALSE} -a \
|
||||
${FLAGS_no_copy_archive} -eq ${FLAGS_FALSE} ] ; then
|
||||
create_archive_dir "${FLAGS_dest_path}/archive"
|
||||
FLAGS_start_server=${FLAGS_TRUE}
|
||||
else
|
||||
@ -180,14 +182,17 @@ if [ "${FLAGS_start_server}" -eq ${FLAGS_TRUE} ] ; then
|
||||
tail -f ${server_logfile} &
|
||||
|
||||
# Now tell the client to load from the server
|
||||
if [ -n "${FLAGS_client_address}" ] ; then
|
||||
if [ -z "${FLAGS_server_address}" ] ; then
|
||||
FLAGS_server_address=${FLAGS_upgrade_server}
|
||||
fi
|
||||
live_args="--update_url=http://${FLAGS_server_address}:${server_port}/update \
|
||||
--remote=${FLAGS_client_address}"
|
||||
if [ -n "${FLAGS_client_address}" ] ; then
|
||||
echo "Running ${SCRIPTS_DIR}/image_to_live.sh $live_args"
|
||||
${SCRIPTS_DIR}/image_to_live.sh $live_args &
|
||||
else
|
||||
echo "Start client upgrade using:"
|
||||
echo " ${SCRIPTS_DIR}/image_to_live.sh ${live_args}<client_ip_address>"
|
||||
fi
|
||||
|
||||
wait ${server_pid}
|
||||
|
Loading…
Reference in New Issue
Block a user