| #!/usr/bin/env bash |
| # Copyright 2017 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. |
| |
| set -euf -o pipefail |
| |
| usage() { |
| echo "Usage: ${0} <os-arch> <ref> <version>" 1>&2 |
| } |
| |
| if [[ $# -ge 1 ]]; then |
| readonly OS_ARCH="${1}" |
| if [[ "$OS_ARCH" != "mac-amd64" && "$OS_ARCH" != "linux-amd64" && "$OS_ARCH" != "linux-arm64" ]]; then |
| usage |
| echo "<os-arch> can be 'mac-amd64' or 'linux-amd64' or 'linux-arm64'" 1>&2 |
| exit 1 |
| fi |
| else |
| usage |
| exit 1 |
| fi |
| |
| if [[ $# -ge 2 ]]; then |
| readonly REF="${2}" |
| else |
| usage |
| exit 1 |
| fi |
| |
| if [[ $# -eq 3 ]]; then |
| readonly VERSION="${3}" |
| else |
| usage |
| exit 1 |
| fi |
| |
| cipd set-ref "fuchsia/tools/jiri/${OS_ARCH}" -ref "${REF}" -version "${VERSION}" |