[ansible][fedora] Update package name
[barometer.git] / ci / utility / intel_cmt_cat_build_install_rpm.sh
1 #!/bin/bash
2 # Copyright 2017 Intel Corporation
3 #
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 DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
17 source $DIR/package-list.sh
18
19 VERSION=$CMTCAT_VERSION
20
21 bash $DIR/check_git_repo.sh $CMTCAT_DIR $CMTCAT_REPO
22 if [[ $? != 0 ]]
23 then
24         rm -rf $CMTCAT_DIR
25         git clone $CMTCAT_REPO $CMTCAT_DIR
26         else
27         cd $CMTCAT_DIR
28         git reset HEAD --hard
29         git pull
30 fi
31 cd $CMTCAT_DIR
32 git checkout -b intel_rdt $CMTCAT_BRANCH
33 wget https://github.com/01org/intel-cmt-cat/archive/${VERSION}.tar.gz --directory-prefix=$CMTCAT_DIR
34 mv $CMTCAT_DIR/${VERSION}.tar.gz $RPM_WORKDIR/SOURCES/
35 rpmbuild --define "_topdir $RPM_WORKDIR" -bb $CMTCAT_DIR/rpm/intel-cmt-cat.spec
36
37 rpm -q intel-cmt-cat-devel
38 if [ $? -eq 0 ]
39 then
40         echo "*** intel-cmt-cat-devel is already installed"
41 else
42         RPM_NAME=`ls -1 $RPM_DIR | grep -E "cmt-cat-[0-9]"`
43         sudo rpm -ivf $RPM_DIR/$RPM_NAME
44         RPM_NAME=`ls -1 $RPM_DIR | grep -E "cmt-cat-devel-[0-9]"`
45         sudo rpm -ivf $RPM_DIR/$RPM_NAME
46 fi