Update vCPE Tosca use case
[integration.git] / test / vcpe_tosca / local / scripts / install-alpine.sh
1 #!/bin/bash
2
3 #*******************************************************************************
4 # Copyright 2017 Huawei Technologies Co., Ltd.
5 #
6 # Licensed under the Apache License, Version 2.0 (the "License");
7 # you may not use this file except in compliance with the License.
8 # You may obtain a copy of the License at
9 #
10 #     http://www.apache.org/licenses/LICENSE-2.0
11 #
12 # Unless required by applicable law or agreed to in writing, software
13 # distributed under the License is distributed on an "AS IS" BASIS,
14 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 # See the License for the specific language governing permissions and
16 # limitations under the License.
17 #*******************************************************************************
18
19 CLI_LATEST_BINARY="https://nexus.onap.org/service/local/artifact/maven/redirect?r=releases&g=org.onap.cli&a=cli-zip&e=zip&v=LATEST"
20 CLI_INSTALL_DIR=/opt/oclip
21 CLI_ZIP=CLI.zip
22 CLI_BIN=/usr/bin/onap
23 CLI_ZIP_DIR=/opt
24 export OPEN_CLI_HOME=$CLI_INSTALL_DIR
25
26 #create install dir
27 if [ -d $CLI_INSTALL_DIR ]
28 then
29     mv $CLI_INSTALL_DIR /opt/cli_`date +"%m-%d-%y-%H-%M-%S"`
30     rm $CLI_BIN
31 fi
32
33 mkdir -p $CLI_INSTALL_DIR
34 cd $CLI_INSTALL_DIR
35
36 #Download and unzip CLI
37 apk update
38 apk add wget unzip openjdk8-jre
39
40 if [ ! -f $CLI_ZIP_DIR/$CLI_ZIP ]
41     then
42         wget -O $CLI_ZIP $CLI_LATEST_BINARY
43     else
44         mv $CLI_ZIP_DIR/$CLI_ZIP .
45     fi
46
47 unzip $CLI_ZIP
48 if [ ! -d ./data ]; then mkdir ./data; fi
49 if [ ! -d ./open-cli-schema ]; then mkdir ./open-cli-schema; fi
50 chmod +x ./bin/oclip.sh
51
52 #Make oclip available in path
53 export OPEN_CLI_HOME=/opt/oclip
54
55 cd $OPEN_CLI_HOME
56
57 if [ ! -d ./data ]; then mkdir ./data; fi
58 if [ ! -d ./open-cli-schema ]; then mkdir ./open-cli-schema; fi
59
60 chmod +x ./bin/oclip.sh
61 chmod +x ./bin/oclip-rcli.sh
62 chmod +x ./bin/oclip-grpc-server.sh
63
64 #Make oclip available in path
65 ln -sf $OPEN_CLI_HOME/bin/oclip.sh /usr/bin/oclip
66 ln -sf $OPEN_CLI_HOME/bin/oclip.sh /usr/bin/onap
67 ln -sf $OPEN_CLI_HOME/bin/oclip-rcli.sh /usr/bin/roclip
68 ln -sf $OPEN_CLI_HOME/bin/oclip-grpc-server.sh /usr/bin/oclip-grpc
69
70 #Print the version
71 oclip -v
72
73 onap -v
74
75 cd -
76