blob: 9dcbfffcb974763df52fa5ef3c6fdb3f1c3c83ed [file] [log] [blame]
#!/usr/bin/env bash
# Copyright 2020 The Go Authors. All rights reserved.
# Use of this source code is governed by a BSD-style
# license that can be found in the LICENSE file.
# Installs all dependencies for a Debian 10 linux arm64 Host which run arm containers.
set -euxo pipefail
TMP_DIR="$(mktemp -d)"
sudo apt-get update && sudo apt-get upgrade -y
sudo apt-get install -y \
apt-transport-https \
ca-certificates \
curl \
gnupg-agent \
gnupg2 \
jq \
curl -fsSL | sudo apt-key add -
sudo add-apt-repository "deb [arch=arm64] $(lsb_release -cs) stable"
sudo apt-get update
sudo apt-get install -y \
docker-ce \
docker-ce-cli \
sudo usermod -aG docker "$USER"
# retrieve the latest version of Go
GO_VERSION="$(curl -s | jq --raw-output '.[0].version')"
GO_SHA="$(curl -s | jq --raw-output '.[0].files | map(select(.arch == "arm64")) | .[0].sha256')"
# download Go package
# verify sha256 shasum"
echo "$GO_SHA $TMP_DIR/$GO_PACKAGE" | sha256sum --check --status
# unzip Go package
tar -xvf "$TMP_DIR/$GO_PACKAGE" -C "$TMP_DIR"
# build rundockerbuildlet
mkdir -p "$GO_PATH"
GOPATH="$GO_PATH" "$TMP_DIR/go/bin/go" get -u
GOPATH="$GO_PATH" "$TMP_DIR/go/bin/go" build -o "$TMP_DIR/rundockerbuildlet"
sudo mv "$TMP_DIR/rundockerbuildlet" /usr/local/bin/rundockerbuildlet
sudo mkdir -p /etc/systemd/system/containerd.service.d/
sudo mv /tmp/containerd.service /etc/systemd/system/containerd.service.d/override.conf
sudo systemctl daemon-reload
sudo systemctl restart docker
sudo mv /tmp/rundockerbuildlet.service /etc/systemd/user/rundockerbuildlet.service
sudo systemctl enable /etc/systemd/user/rundockerbuildlet.service
sudo systemctl start rundockerbuildlet
# remove temporary directory
rm -fr "$TMP_DIR"