open-nomad/scripts/linux-priv-cni.sh

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

32 lines
717 B
Bash
Raw Permalink Normal View History

2019-09-05 18:12:39 +00:00
#!/usr/bin/env bash
# Copyright (c) HashiCorp, Inc.
# SPDX-License-Identifier: MPL-2.0
2019-09-05 18:12:39 +00:00
set -o errexit
# Minimal effort to support amd64 and arm64 installs.
ARCH=""
case $(arch) in
x86_64) ARCH="amd64" ;;
aarch64) ARCH="arm64" ;;
esac
VERSION="v1.0.0"
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
CONFIG_DIR=/opt/cni/config
2019-09-05 18:12:39 +00:00
function install_cni() {
mkdir -p ${TARGET_DIR} ${CONFIG_DIR}
2019-09-05 18:12:39 +00:00
if [[ -e ${TARGET_DIR}/${VERSION} ]] ; then
return
fi
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