blob: a4e3a9690c41311f364e7ec65ede4ca151f6683d [file] [log] [blame]
#!/bin/bash
# Copyright 2018 The Fuchsia Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
### do a system OTA
## usage: fx ota [-d|--device <device_address>] [-h|--help]
##
## Ask the target to do an OTA. The target will use any update server available
## to it to do the update. This requires the target have a update server
## available to it. The 'serve' command is typically used to make your
## development host available to the target as an update server.
##
## Arguments:
## -h|--help Print out this message.
## -d|--device Fuchsia link-local name of the device. If not
## specified, will connect to the only available
## device on the link-local network.
source "$(cd "$(dirname "${BASH_SOURCE[0]}")" >/dev/null 2>&1 && pwd)"/lib/vars.sh || exit $?
fx-config-read
function main {
fx-standard-switches "$@"
set -- "${FX_ARGV[@]}"
if [[ -z "$(pgrep -f "amber-files/repository")" ]]; then
echo "WARNING: It looks like serve-updates is not running."
echo "WARNING: You probably need to start \"fx serve\""
return -1
fi
fx-command-run shell "$@" amber_ctl system_update
local r=$?
echo "Check the target's log for update progress"
return $r
}
main "$@"