blob: 1db2dea2ca4b0cfcc3ae2a3d74eb062e5881000a [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 [-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' fx command is typically used to make your
## development host available to the target as an update server.
##
## Arguments:
## -h|--help Print out this message.
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 "$@"