2019-09-05 18:12:39 +00:00
|
|
|
#!/usr/bin/env bash
|
2023-04-10 15:36:59 +00:00
|
|
|
# Copyright (c) HashiCorp, Inc.
|
|
|
|
# SPDX-License-Identifier: MPL-2.0
|
|
|
|
|
2019-09-05 18:12:39 +00:00
|
|
|
|
|
|
|
set -o errexit
|
|
|
|
|
2023-03-28 15:21:14 +00:00
|
|
|
# Minimal effort to support amd64 and arm64 installs.
|
|
|
|
ARCH=""
|
|
|
|
case $(arch) in
|
|
|
|
x86_64) ARCH="amd64" ;;
|
|
|
|
aarch64) ARCH="arm64" ;;
|
|
|
|
esac
|
|
|
|
|
2021-08-27 09:14:47 +00:00
|
|
|
VERSION="v1.0.0"
|
2023-03-28 15:21:14 +00:00
|
|
|
DOWNLOAD=https://github.com/containernetworking/plugins/releases/download/${VERSION}/cni-plugins-linux-${ARCH}-${VERSION}.tgz
|
2019-09-05 18:12:39 +00:00
|
|
|
TARGET_DIR=/opt/cni/bin
|
2021-08-31 14:22:52 +00:00
|
|
|
CONFIG_DIR=/opt/cni/config
|
2019-09-05 18:12:39 +00:00
|
|
|
|
|
|
|
function install_cni() {
|
2021-08-31 14:22:52 +00:00
|
|
|
mkdir -p ${TARGET_DIR} ${CONFIG_DIR}
|
2019-09-05 18:12:39 +00:00
|
|
|
if [[ -e ${TARGET_DIR}/${VERSION} ]] ; then
|
|
|
|
return
|
|
|
|
fi
|
|
|
|
|
2020-03-23 15:47:26 +00:00
|
|
|
curl -sSL --fail -o /tmp/cni-plugins.tar.gz ${DOWNLOAD}
|
2019-09-05 18:12:39 +00:00
|
|
|
tar -xf /tmp/cni-plugins.tar.gz -C ${TARGET_DIR}
|
|
|
|
touch ${TARGET_DIR}/${VERSION}
|
|
|
|
}
|
|
|
|
|
|
|
|
install_cni
|