xref: /aosp_15_r20/external/crosvm/infra/cipd/package_rustup-init.sh (revision bb4ee6a4ae7042d18b07a98463b9c8b875e44b39)
1#!/usr/bin/env bash
2# Copyright 2022 The ChromiumOS Authors
3# Use of this source code is governed by a BSD-style license that can be
4# found in the LICENSE file.
5
6set -ex
7
8BUILD_DIR=$(mktemp -d)
9cd "$BUILD_DIR" || exit 1
10
11CIPD_ARGS=(
12    -pkg-var "description:rustup-init to set up rustup.rs"
13    -install-mode copy
14    -ref latest
15)
16
17RUSTUP_WIN="https://static.rust-lang.org/rustup/dist/x86_64-pc-windows-msvc/rustup-init.exe"
18RUSTUP_LINUX="https://static.rust-lang.org/rustup/dist/x86_64-unknown-linux-gnu/rustup-init"
19
20cd $(mktemp -d)
21wget "$RUSTUP_WIN" -O "rustup-init.exe"
22cipd create -in "." -name "crosvm/rustup-init/windows-amd64" "${CIPD_ARGS[@]}"
23
24cd $(mktemp -d)
25wget "$RUSTUP_LINUX" -O "rustup-init"
26chmod +x "rustup-init"
27cipd create -in "." -name "crosvm/rustup-init/linux-amd64" "${CIPD_ARGS[@]}"
28
29