delete file header
[bottlenecks.git] / vstf / tool_package / install.sh
1 #!/bin/bash
2 ##############################################################################
3 # Copyright (c) 2015 Huawei Technologies Co.,Ltd and others.
4 #
5 # All rights reserved. This program and the accompanying materials
6 # are made available under the terms of the Apache License, Version 2.0
7 # which accompanies this distribution, and is available at
8 # http://www.apache.org/licenses/LICENSE-2.0
9 ##############################################################################
10
11 function usage()
12 {
13     echo -e "install:
14     install [path];
15     -->ops:
16         path: path of the souce code, default : './'
17     "
18 }
19
20 function install()
21 {
22     local file=$1
23     local dir=${file%.tar.gz}
24     tar -zxvf $file
25     cd $dir
26     if [ -e "configure" ]; then
27         ./configure
28     fi
29     if [ -e "Makefile" ]; then
30         make && make install
31         echo "install $dir successfully"
32     else
33         echo "install $dir failed"
34     fi
35
36     cd .. && rm $dir -r
37
38 }
39
40 if [ $# -gt  2 ]; then
41     usage
42     exit -1
43 fi
44
45 code_path="./"
46 if [ $# -eq  2 ]; then
47     code_path=$1
48 fi
49 cd $code_path
50 for file in $(ls *.tar.gz);do
51     install $file
52 done
53