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

22 lines
506 B
Bash
Raw Normal View History

2019-09-05 18:12:39 +00:00
#!/usr/bin/env bash
set -o errexit
VERSION="v1.0.0"
2019-09-05 18:12:39 +00:00
DOWNLOAD=https://github.com/containernetworking/plugins/releases/download/${VERSION}/cni-plugins-linux-amd64-${VERSION}.tgz
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