4a7e7a1a4d1a57d1def4128458b5aa833adb51b3
[appc.git] / appc-lifecycle-management / appc-lifecycle-management-installer / src / main / resources / scripts / install-feature.sh
1 ###\r
2 # ============LICENSE_START=======================================================
3 # ONAP : APPC
4 # ================================================================================
5 # Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
6 # ================================================================================
7 # Copyright (C) 2017 Amdocs\r
8 # =============================================================================\r
9 # Licensed under the Apache License, Version 2.0 (the "License");\r
10 # you may not use this file except in compliance with the License.\r
11 # You may obtain a copy of the License at\r
12\r
13 #      http://www.apache.org/licenses/LICENSE-2.0\r
14\r
15 # Unless required by applicable law or agreed to in writing, software\r
16 # distributed under the License is distributed on an "AS IS" BASIS,\r
17 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
18 # See the License for the specific language governing permissions and\r
19 # limitations under the License.\r
20\r
21 # ECOMP is a trademark and service mark of AT&T Intellectual Property.
22 # ============LICENSE_END=========================================================\r
23 ###\r
24 \r
25 #!/bin/bash\r
26 \r
27 ODL_HOME=${ODL_HOME:-/opt/opendaylight/current}\r
28 ODL_KARAF_CLIENT=${ODL_KARAF_CLIENT:-${ODL_HOME}/bin/client}\r
29 ODL_KARAF_CLIENT_OPTS=${ODL_KARAF_CLIENT_OPTS:-"-u karaf"}\r
30 INSTALLERDIR=$(dirname $0)\r
31 \r
32 REPOZIP=${INSTALLERDIR}/${features.boot}-${project.version}.zip\r
33 \r
34 if [ -f ${REPOZIP} ]\r
35 then\r
36     unzip -n -d ${ODL_HOME} ${REPOZIP}\r
37 else\r
38     echo "ERROR : repo zip ($REPOZIP) not found"\r
39     exit 1\r
40 fi\r
41 \r
42 COUNT=0\r
43 while [ $COUNT -lt 10 ]; do\r
44     ${ODL_KARAF_CLIENT} ${ODL_KARAF_CLIENT_OPTS} feature:repo-add ${features.repositories} 2> /tmp/installErr\r
45     cat /tmp/installErr\r
46     if grep -q 'Failed to get the session' /tmp/installErr; then\r
47         sleep 10\r
48     else\r
49         let COUNT=10\r
50     fi\r
51     let COUNT=COUNT+1\r
52 done\r
53 COUNT=0\r
54 while [ $COUNT -lt 10 ]; do\r
55     ${ODL_KARAF_CLIENT} ${ODL_KARAF_CLIENT_OPTS} feature:install ${features.boot} 2> /tmp/installErr\r
56         cat /tmp/installErr\r
57     if grep -q 'Failed to get the session' /tmp/installErr; then\r
58         sleep 10\r
59     else\r
60         let COUNT=10\r
61     fi\r
62     let COUNT=COUNT+1\r
63 done\r