github.com/manicqin/nomad@v0.9.5/scripts/travis-rkt.sh (about)

     1  #!/usr/bin/env bash
     2  
     3  set -o errexit
     4  
     5  VERSION=1.27.0
     6  DOWNLOAD=https://github.com/coreos/rkt/releases/download/v${VERSION}/rkt-v${VERSION}.tar.gz
     7  
     8  function install_rkt() {
     9  	if [[ -e /usr/local/bin/rkt ]] ; then
    10  		if [ "rkt Version: ${VERSION}" == "$(rkt version | head -n1)" ] ; then
    11  			return
    12  		fi
    13  	fi
    14  	
    15  	wget -q -O /tmp/rkt.tar.gz "${DOWNLOAD}"
    16  
    17  	tar -C /tmp -xvf /tmp/rkt.tar.gz
    18  	mv /tmp/rkt-v${VERSION}/rkt /usr/local/bin
    19  	mv /tmp/rkt-v${VERSION}/*.aci /usr/local/bin
    20  }
    21  
    22  function configure_rkt_networking() {
    23  	if [[ -e /etc/rkt/net.d/99-network.conf ]] ; then
    24  		return
    25  	fi
    26  
    27  	mkdir -p /etc/rkt/net.d
    28  	cat <<EOT > /etc/rkt/net.d/99-network.conf
    29  {
    30    "name": "default",
    31    "type": "ptp",
    32    "ipMasq": false,
    33    "ipam": {
    34      "type": "host-local",
    35      "subnet": "172.16.28.0/24",
    36      "routes": [
    37        {
    38          "dst": "0.0.0.0/0"
    39        }
    40      ]
    41    }
    42  }
    43  EOT
    44  }
    45  
    46  install_rkt
    47  configure_rkt_networking