github.com/anth0d/nomad@v0.0.0-20221214183521-ae3a0a2cad06/scripts/vagrant-linux-priv-cni.sh (about)

     1  #!/usr/bin/env bash
     2  
     3  set -o errexit
     4  
     5  VERSION="v1.0.0"
     6  DOWNLOAD=https://github.com/containernetworking/plugins/releases/download/${VERSION}/cni-plugins-linux-amd64-${VERSION}.tgz
     7  TARGET_DIR=/opt/cni/bin
     8  CONFIG_DIR=/opt/cni/config
     9  
    10  function install_cni() {
    11  	mkdir -p ${TARGET_DIR} ${CONFIG_DIR}
    12  	if [[ -e ${TARGET_DIR}/${VERSION} ]] ; then
    13  		return
    14  	fi
    15  
    16  	curl -sSL --fail -o /tmp/cni-plugins.tar.gz ${DOWNLOAD}
    17  	tar -xf /tmp/cni-plugins.tar.gz -C ${TARGET_DIR}
    18  	touch ${TARGET_DIR}/${VERSION}
    19  }
    20  
    21  install_cni