blob: 3ec84ce5456ea5df0562e774a3f360c0be33fd79 [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 full update of a target system
## usage: fx update [-h|--help]
##
## Ask the target to update all packages that it has, then 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 $?
source "$(cd "$(dirname "${BASH_SOURCE[0]}")" >/dev/null 2>&1 && pwd)"/lib/updates.sh || exit $?
fx-config-read
function main {
fx-standard-switches "$@"
set -- "${FX_ARGV[@]}"
check-for-amber-server || return -1
for pkg in $(cat "${FUCHSIA_BUILD_DIR}/preinstall_packages.list"); do
fx-command-run shell amberctl get_up -n "${pkg}" -v 0
done
fx-command-run ota
}
main "$@"