547f44493eccdf043800dab530db1e9920835578
[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 URL="https://nexus.fd.io/service/local/artifact/maven/content"
19 VER="RELEASE"
20 GROUP="io.fd.vpp"
21
22 if [ -f "/etc/redhat-release" ]; then
23     trap 'rm -f *.rpm.md5; exit' EXIT
24     trap 'rm -f *.rpm.md5;rm -f *.rpm; exit' ERR
25
26     VPP_REPO_URL_PATH="./VPP_REPO_URL_CENTOS"
27     if [ -e "$VPP_REPO_URL_PATH" ]; then
28         VPP_REPO_URL=$(cat $VPP_REPO_URL_PATH)
29         REPO=$(echo ${VPP_REPO_URL#https://nexus.fd.io/content/repositories/})
30         REPO=$(echo ${REPO%/io/fd/vpp/})
31     else
32         REPO='fd.io.master.centos7'
33     FILES=*.rpm
34     MD5FILES=*.rpm.md5
35     fi
36
37     ARTIFACTS="vpp vpp-debuginfo vpp-devel vpp-dpdk-devel vpp-lib vpp-plugins"
38     PACKAGE="rpm rpm.md5"
39     CLASS=""
40     VPP_INSTALL_COMMAND="rpm -ivh *.rpm"
41 else
42     trap 'rm -f *.deb.md5; exit' EXIT
43     trap 'rm -f *.deb.md5;rm -f *.deb; exit' ERR
44
45     VPP_REPO_URL_PATH="./VPP_REPO_URL_UBUNTU"
46     if [ -e "$VPP_REPO_URL_PATH" ]; then
47         VPP_REPO_URL=$(cat $VPP_REPO_URL_PATH)
48         REPO=$(echo ${VPP_REPO_URL#https://nexus.fd.io/content/repositories/})
49         REPO=$(echo ${REPO%/io/fd/vpp/})
50     else
51         REPO='fd.io.master.ubuntu.xenial.main'
52     FILES=*.deb
53     MD5FILES=*.deb.md5
54     fi
55
56     ARTIFACTS="vpp vpp-dbg vpp-dev vpp-dpdk-dev vpp-dpdk-dkms vpp-lib vpp-plugins"
57     PACKAGE="deb deb.md5"
58     CLASS="deb"
59     VPP_INSTALL_COMMAND="dpkg -i *.deb"
60 fi
61
62 for ART in ${ARTIFACTS}; do
63     for PAC in $PACKAGE; do
64         curl "${URL}?r=${REPO}&g=${GROUP}&a=${ART}&p=${PAC}&v=${VER}&c=${CLASS}" -O -J || exit
65     done
66 done
67
68 for FILE in ${FILES}; do
69     echo " "${FILE} >> ${FILE}.md5
70 done
71
72 for MD5FILE in ${MD5FILES}; do
73     md5sum -c ${MD5FILE} || exit
74 done
75
76 if [ "$1" != "--skip-install" ]; then
77     echo Installing VPP
78     sudo ${VPP_INSTALL_COMMAND}
79 else
80     echo VPP Installation skipped
81 fi

©2016 FD.io a Linux Foundation Collaborative Project. All Rights Reserved.
Linux Foundation is a registered trademark of The Linux Foundation. Linux is a registered trademark of Linus Torvalds.
Please see our privacy policy and terms of use.