CSIT-461 Fix VPP version variable in perf bootstrap
[csit.git] / resources / tools / download_install_vpp_pkgs.sh
1 #!/bin/bash
2
3 # Copyright (c) 2016 Cisco and/or its affiliates.
4 # Licensed under the Apache License, Version 2.0 (the "License");
5 # you may not use this file except in compliance with the License.
6 # You may obtain a copy of the License at:
7 #
8 #     http://www.apache.org/licenses/LICENSE-2.0
9 #
10 # Unless required by applicable law or agreed to in writing, software
11 # distributed under the License is distributed on an "AS IS" BASIS,
12 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 # See the License for the specific language governing permissions and
14 # limitations under the License.
15
16 set -ex
17
18 trap 'rm -f *.deb.md5; exit' EXIT
19 trap 'rm -f *.deb.md5;rm -f *.deb; exit' ERR
20
21 URL="https://nexus.fd.io/service/local/artifact/maven/content"
22 VER="RELEASE"
23
24 VPP_REPO_URL_PATH="./VPP_REPO_URL"
25 if [ -e "$VPP_REPO_URL_PATH" ]; then
26     VPP_REPO_URL=$(cat $VPP_REPO_URL_PATH)
27     REPO=$(echo ${VPP_REPO_URL#https://nexus.fd.io/content/repositories/})
28     REPO=$(echo ${REPO%/io/fd/vpp/})
29 else
30     REPO='fd.io.master.ubuntu.xenial.main'
31 fi
32
33 GROUP="io.fd.vpp"
34 ARTIFACTS="vpp vpp-dbg vpp-dev vpp-dpdk-dev vpp-dpdk-dkms vpp-lib vpp-plugins"
35 PACKAGE="deb deb.md5"
36 CLASS="deb"
37
38 for ART in ${ARTIFACTS}; do
39     for PAC in $PACKAGE; do
40         curl "${URL}?r=${REPO}&g=${GROUP}&a=${ART}&p=${PAC}&v=${VER}&c=${CLASS}" -O -J || exit
41     done
42 done
43
44 for FILE in *.deb; do
45     echo " "${FILE} >> ${FILE}.md5
46 done
47
48 for MD5FILE in *.md5; do
49     md5sum -c ${MD5FILE} || exit
50 done
51
52 if [ "$1" != "--skip-install" ]; then
53     echo Installing VPP
54     sudo dpkg -i *.deb
55 else
56     echo VPP Installation skipped
57 fi