| #!/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. |
| |
| #### CATEGORY=Software delivery |
| ### unregister a repository package server as a device's update source |
| |
| ## usage: fx remove-update-source [--repo-name NAME] |
| ## |
| ## Removes the repository as an update source on the target device. |
| ## |
| ## --repo-name NAME Name of the repository package server to use as the update source. |
| ## |
| ## NAME: |
| ## If no name is supplied, the name defaults to configured default repository. |
| ## |
| ## Note: |
| ## This is a wrapper for `ffx target repository deregister` |
| |
| 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 usage { |
| fx-command-help remove-update-source |
| } |
| |
| function main { |
| fx-standard-switches "$@" |
| set -- "${FX_ARGV[@]}" |
| |
| repo_name="" |
| while [[ $# -ne 0 ]]; do |
| case "$1" in |
| --repo-name) |
| repo_name="$2" |
| shift |
| ;; |
| *) |
| fx-error "Unrecognized option: $1" |
| usage |
| exit 1 |
| esac |
| shift |
| done |
| |
| deregister_flags=( target repository deregister ) |
| if [[ -n "${repo_name}" ]]; then |
| deregister_flags+=( --repository "${repo_name}" ) |
| fi |
| |
| fx-command-run ffx "${deregister_flags[@]}" |
| } |
| |
| main "$@" |