Skip to content

Instantly share code, notes, and snippets.

@NiklasRosenstein
Last active October 16, 2022 16:02
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save NiklasRosenstein/e89e5736a29a802991f5e2132701c648 to your computer and use it in GitHub Desktop.
Save NiklasRosenstein/e89e5736a29a802991f5e2132701c648 to your computer and use it in GitHub Desktop.

Install script for WeaveWorks ignite.

sudo bash <(curl -sfL https://gist.githubusercontent.com/NiklasRosenstein/e89e5736a29a802991f5e2132701c648/raw/get-ignite.sh)
#!/bin/bash
# https://github.com/weaveworks/ignite/blob/main/docs/installation.md
set -euo pipefail
DEFAULT_CNI_VERSION=v0.9.1
DEFAULT_IGNITE_VERSION=v0.10.0
function main() {
echo -n "CNI_VERSION? [$DEFAULT_CNI_VERSION] "
read -r CNI_VERSION
CNI_VERSION=${CNI_VERSION:-$DEFAULT_CNI_VERSION}
echo -n "IGNITE_VERSION? [$DEFAULT_IGNITE_VERSION] "
read -r IGNITE_VERSION
IGNITE_VERSION=${IGNITE_VERSION:-$DEFAULT_IGNITE_VERSION}
install-system-packages
install-cni-plugins $CNI_VERSION
install-ignite $IGNITE_VERSION
}
function get-arch() {
case "$(uname -m)" in
x86_64|amd64) echo amd64;;
aarch64|arm64) echo arm64;;
*) >&2 echo "error: unknown architecture ($(uname -m))"; exit 1;;
esac
}
function install-system-packages() {
if which apt-get >/dev/null; then
sudo apt-get update
sudo apt-get install -y --no-install-recommends dmsetup openssh-client git binutils
which containerd >/dev/null || sudo apt-get install -y --no-install-recommends containerd
elif which yum >/dev/null; then
yum install -y e2fsprogs openssh-clients git
if cat /etc/os-release | grep "Amazon Linux" >/dev/null; then
which containerd >dev/null || sudo amazon-linux-extras enable docker && yum install -y containerd
else
which containerd >/dev/null || ( ysudo um-config-manager --add-repo https://download.docker.com/linux/centos/docker-ce.repo && sudo yum install -y containerd.io )
fi
fi
}
function install-cni-plugins() {
local CNI_VERSION
CNI_VERSION="$1"
local URL
URL=https://github.com/containernetworking/plugins/releases/download/${CNI_VERSION}/cni-plugins-linux-$(get-arch)-${CNI_VERSION}.tgz
echo "Installing CNI plugins $CNI_VERSION to /opt/cni/bin from $URL"
sudo rm -rf /opt/cni/bin
sudo mkdir -p /opt/cni/bin
curl -sSL $URL | sudo tar -xz -C /opt/cni/bin
}
function install-ignite() {
local VERSION
VERSION="$1"
for BINARY in ignite ignited; do
local URL
URL=https://github.com/weaveworks/ignite/releases/download/${VERSION}/${BINARY}-$(get-arch)
echo "Installing ${BINARY} $VERSION to /usr/local/bin from $URL"
curl -sfLo ${BINARY} "$URL"
chmod +x ${BINARY}
sudo mv ${BINARY} /usr/local/bin
done
}
main
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment