#!/usr/bin/env bash # This script performs one-time bootstrap of required repo tooling to the developer # machine. # # Once just is installed, everything else can be managed via the justfiles + Bazel # set -euo pipefail bin="${1:-$HOME/bin}" hackdir="$(pwd)/$(dirname "${BASH_SOURCE[0]}")" VERSION="1.1.2" OS="apple-darwin" if [[ "$OSTYPE" == "linux-gnu"* ]]; then OS="unknown-linux-musl" fi # determine the architecture # apple silicon should use aarch64 https://github.com/casey/just/issues/1132 ARCH="aarch64" MACHINE_TYPE=$(uname -m) if [ "${MACHINE_TYPE}" == 'x86_64' ]; then ARCH="x86_64" fi JUST_DOWNLOAD_URL="https://github.com/casey/just/releases/download/$VERSION/just-$VERSION-$ARCH-$OS.tar.gz" echo "================================" echo "Creating $bin if it doesn't exist" echo "================================" mkdir -p "$bin" echo "================================" echo "Downloading just release tarball" echo "================================" rm -rf tmp mkdir tmp ( cd tmp curl -L "$JUST_DOWNLOAD_URL" | tar xz echo "================================" echo "Moving just to $bin/just" echo "================================" chmod +x just mv just "$bin"/just ) echo "================================" echo "Testing just" echo "================================" "$bin"/just --version echo "================================" echo "Cleaning up tmpdir" echo "================================" cd .. || exit rm -rf tmp echo "================================" echo "Installing Bazel and iBazel" echo "================================" "$bin"/just -d "$hackdir" -f "$hackdir/justfile" bin_dir="$bin" bazel echo "================================" echo "Testing just" echo "================================" "$bin"/just --version