add new topology parameter: arch
[csit.git] / resources / tools / scripts / download_hc_pkgs.sh
1 #!/bin/bash
2
3 # Copyright (c) 2017 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 STREAM=$1
19 OS=$2
20
21 URL="https://nexus.fd.io/service/local/artifact/maven/content"
22 VER="RELEASE"
23 GROUP="io.fd.vpp"
24 HC_GROUP="io.fd.hc2vpp"
25 NSH_GROUP="io.fd.nsh_sfc"
26 HC_ARTIFACTS="honeycomb"
27 NSH_ARTIFACTS="vpp-nsh-plugin"
28
29 if [ "${OS}" == "ubuntu1404" ]; then
30     OS="ubuntu.trusty.main"
31     PACKAGE="deb deb.md5"
32     CLASS="deb"
33     VPP_ARTIFACTS="vpp vpp-dbg vpp-lib vpp-plugins"
34     DPDK_ARTIFACTS="vpp-dpdk-dkms"
35 elif [ "${OS}" == "ubuntu1604" ]; then
36     OS="ubuntu.xenial.main"
37     PACKAGE="deb deb.md5"
38     CLASS="deb"
39     VPP_ARTIFACTS="vpp vpp-dbg vpp-lib vpp-plugins"
40     DPDK_ARTIFACTS="vpp-dpdk-dkms"
41 elif [ "${OS}" == "centos7" ]; then
42     OS="centos7"
43     PACKAGE="rpm rpm.md5"
44     CLASS=""
45     VPP_ARTIFACTS="vpp vpp-debuginfo vpp-lib vpp-plugins"
46     DPDK_ARTIFACTS=""
47 fi
48
49 REPO="fd.io.${STREAM}.${OS}"
50
51 # download latest honeycomb, vpp-dpdk and nsh packages
52 for ART in ${HC_ARTIFACTS}; do
53     for PAC in ${PACKAGE}; do
54         curl "${URL}?r=${REPO}&g=${HC_GROUP}&a=${ART}&p=${PAC}&v=${VER}&c=${CLASS}" -O -J || exit
55     done
56 done
57
58 for ART in ${DPDK_ARTIFACTS}; do
59     for PAC in ${PACKAGE}; do
60         curl "${URL}?r=${REPO}&g=${GROUP}&a=${ART}&p=${PAC}&v=${VER}&c=${CLASS}" -O -J || exit
61     done
62 done
63
64 for ART in ${NSH_ARTIFACTS}; do
65     for PAC in ${PACKAGE}; do
66         curl "${URL}?r=${REPO}&g=${NSH_GROUP}&a=${ART}&p=${PAC}&v=${VER}&c=${CLASS}" -O -J || exit
67     done
68 done
69
70 # determine VPP dependency
71 if [ "${OS}" == "centos7" ]; then
72     VER=`rpm -qpR honeycomb*.rpm | grep 'vpp ' | cut -d ' ' -f 3`
73     VER=${VER}.x86_64
74 else
75     VER=`dpkg -I honeycomb*.deb | grep -oP 'vpp \(= \K[^\)]+'`
76     VER=${VER}_amd64
77 fi
78
79 # download VPP packages
80 for ART in ${VPP_ARTIFACTS}; do
81     for PAC in ${PACKAGE}; do
82         curl "${URL}?r=${REPO}&g=${GROUP}&a=${ART}&p=${PAC}&v=${VER}&c=${CLASS}" -O -J || exit
83     done
84 done
85
86 # verify downloaded package
87 if [ "${OS}" == "centos7" ]; then
88     FILES=*.rpm
89 else
90     FILES=*.deb
91 fi
92
93 for FILE in ${FILES}; do
94     echo " "${FILE} >> ${FILE}.md5
95 done
96 for MD5FILE in *.md5; do
97     md5sum -c ${MD5FILE} || exit
98     rm ${MD5FILE}
99 done