...

Text file src/edge-infra.dev/hack/bootstrap-repo-tools.sh

Documentation: edge-infra.dev/hack

     1#!/usr/bin/env bash
     2
     3# This script performs one-time bootstrap of required repo tooling to the developer 
     4# machine.
     5#
     6# Once just is installed, everything else can be managed via the justfiles + Bazel
     7#
     8
     9set -euo pipefail
    10
    11bin="${1:-$HOME/bin}"
    12hackdir="$(pwd)/$(dirname "${BASH_SOURCE[0]}")"
    13
    14VERSION="1.1.2"
    15OS="apple-darwin"
    16if [[ "$OSTYPE" == "linux-gnu"* ]]; then
    17  OS="unknown-linux-musl"
    18fi
    19
    20# determine the architecture 
    21# apple silicon should use aarch64 https://github.com/casey/just/issues/1132
    22ARCH="aarch64"
    23MACHINE_TYPE=$(uname -m)
    24if [ "${MACHINE_TYPE}" == 'x86_64' ]; then
    25  ARCH="x86_64"
    26fi
    27
    28JUST_DOWNLOAD_URL="https://github.com/casey/just/releases/download/$VERSION/just-$VERSION-$ARCH-$OS.tar.gz"
    29
    30echo "================================"
    31echo "Creating $bin if it doesn't exist"
    32echo "================================"
    33mkdir -p "$bin"
    34
    35echo "================================"
    36echo "Downloading just release tarball"
    37echo "================================"
    38rm -rf tmp
    39mkdir tmp
    40
    41(
    42  cd tmp
    43  curl -L "$JUST_DOWNLOAD_URL" | tar xz
    44  echo "================================"
    45  echo "Moving just to $bin/just"
    46  echo "================================"
    47  chmod +x just
    48  mv just "$bin"/just
    49)
    50
    51
    52echo "================================"
    53echo "Testing just"
    54echo "================================"
    55"$bin"/just --version
    56
    57echo "================================"
    58echo "Cleaning up tmpdir"
    59echo "================================"
    60cd .. || exit
    61rm -rf tmp
    62
    63echo "================================"
    64echo "Installing Bazel and iBazel"
    65echo "================================"
    66"$bin"/just -d "$hackdir" -f "$hackdir/justfile" bin_dir="$bin" bazel
    67
    68echo "================================"
    69echo "Testing just"
    70echo "================================"
    71"$bin"/just --version

View as plain text