HC Test: reorder commands in HC package download script
[csit.git] / resources / tools / download_hc_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 STREAM=$1
21 OS=$2
22
23 URL="https://nexus.fd.io/service/local/artifact/maven/content"
24 VER="RELEASE"
25 GROUP="io.fd.vpp"
26 HC_GROUP="io.fd.hc2vpp"
27 NSH_GROUP="io.fd.nsh_sfc"
28 VPP_ARTIFACTS="vpp vpp-dbg vpp-dev vpp-dpdk-dev vpp-dpdk-dkms vpp-lib vpp-plugins vpp-api-java"
29 HC_ARTIFACTS="honeycomb"
30 NSH_ARTIFACTS="vpp-nsh-plugin"
31
32 if [ "${OS}" == "ubuntu1404" ]; then
33     OS="ubuntu.trusty.main"
34     PACKAGE="deb deb.md5"
35     CLASS="deb"
36 elif [ "${OS}" == "ubuntu1604" ]; then
37     OS="ubuntu.xenial.main"
38     PACKAGE="deb deb.md5"
39     CLASS="deb"
40 elif [ "${OS}" == "centos7" ]; then
41     OS="centos7"
42     PACKAGE="rpm rpm.md5"
43     CLASS="rpm"
44 fi
45
46 REPO="fd.io.${STREAM}.${OS}"
47
48 for ART in ${VPP_ARTIFACTS}; do
49     for PAC in $PACKAGE; do
50         curl "${URL}?r=${REPO}&g=${GROUP}&a=${ART}&p=${PAC}&v=${VER}&c=${CLASS}" -O -J || exit
51     done
52 done
53
54 for ART in ${HC_ARTIFACTS}; do
55     for PAC in $PACKAGE; do
56         curl "${URL}?r=${REPO}&g=${HC_GROUP}&a=${ART}&p=${PAC}&v=${VER}&c=${CLASS}" -O -J || exit
57     done
58 done
59
60 for ART in ${NSH_ARTIFACTS}; do
61     for PAC in $PACKAGE; do
62         curl "${URL}?r=${REPO}&g=${NSH_GROUP}&a=${ART}&p=${PAC}&v=${VER}&c=${CLASS}" -O -J || exit
63     done
64 done
65
66 for FILE in *.deb; do
67     echo " "${FILE} >> ${FILE}.md5
68 done
69
70 for MD5FILE in *.md5; do
71     md5sum -c ${MD5FILE} || exit
72 done