#!/bin/bash

# Usage:
# bash <(curl -s https://scripts.justman10000.de/installers/buildx.sh)

[[ -z $HOME ]] && [[ $(whoami) == "root" ]] && $HOME=/root

mkdir -p $HOME/.docker/cli-plugins

[[ /home/buildx ]] && rm -r /home/buildx
mkdir /home/buildx
cd /home/buildx
git init
git pull https://github.com/docker/buildx.git

go build -C cmd/buildx -o $HOME/.docker/cli-plugins/docker-buildx .