Add features not being installed
[appc/deployment.git] / installation / appc / src / main / scripts / installZips.sh
1 #!/bin/bash
2
3 ###
4 # ============LICENSE_START=======================================================
5 # APPC
6 # ================================================================================
7 # Copyright (C) 2017 AT&T Intellectual Property. All rights reserved.
8 # ================================================================================
9 # Licensed under the Apache License, Version 2.0 (the "License");
10 # you may not use this file except in compliance with the License.
11 # You may obtain a copy of the License at
12
13 #      http://www.apache.org/licenses/LICENSE-2.0
14
15 # Unless required by applicable law or agreed to in writing, software
16 # distributed under the License is distributed on an "AS IS" BASIS,
17 # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
18 # See the License for the specific language governing permissions and
19 # limitations under the License.
20 # ============LICENSE_END=========================================================
21 # ECOMP is a trademark and service mark of AT&T Intellectual Property.
22 ###
23
24 if [ -z "$SETTINGS_FILE" -a -z "$GLOBAL_SETTINGS_FILE" -a -s "$HOME"/.m2/settings.xml ]
25 then
26   DEFAULT_MAVEN_SETTINGS=${HOME}/.m2/settings.xml
27   SETTINGS_FILE=${SETTINGS_FILE:-${DEFAULT_MAVEN_SETTINGS}}
28   GLOBAL_SETTINGS_FILE=${GLOBAL_SETTINGS_FILE:-${DEFAULT_MAVEN_SETTINGS}}
29 fi
30
31 APPC_HOME=${APPC_HOME:-/opt/onap/appc}
32 SDNC_HOME=${SDNC_HOME:-/opt/onap/sdnc}
33
34 targetDir=${1:-${APPC_HOME}}
35 sdnc_targetDir=${1:-${SDNC_HOME}}
36
37 #We are going to use a series of directories in the docker-stage folder to extract features to.
38 #By extracting features into more than one directory, we can copy them into the docker image in
39 #different parts, creating more even layer sizes in the docker image.
40 featureDir=$2/featureDir
41
42 #This value determine how many feature directories we want. The featutures will be evenly split
43 #into the number of directories specified. Any remainder will be put into the last directory.
44 #IF THE FEATURES_DIRECTORY_COUNT IS CHANGED, THE DOCKERFILE MUST ALSO BE UPDATED SINCE IT CONTAINS
45 #A COPY COMMAND FOR EACH FEATURE DIRECTORY!! See the Dockerfile for more information.
46 FEATURE_DIRECTORY_COUNT=4
47
48 APPC_FEATURES=" \
49  appc-sdc-listener \
50  appc-lifecycle-management \
51  appc-provider \
52  appc-event-listener \
53  appc-dispatcher \
54  appc-chef-adapter \
55  appc-netconf-adapter \
56  appc-rest-adapter \
57  appc-dmaap-adapter \
58  appc-dg-util \
59  appc-metric \
60  appc-dg-shared \
61  appc-iaas-adapter \
62  appc-ansible-adapter \
63  appc-oam \
64  appc-sequence-generator \
65  appc-config-generator \
66  appc-config-data-services \
67  appc-artifact-handler \
68  appc-config-adaptor \
69  appc-config-audit \
70  appc-config-encryption-tool \
71  appc-config-flow-controller \
72  appc-config-params \
73  appc-aai-client \
74  appc-network-inventory-client \
75  appc-design-services"
76
77 FEATURES_PER_DIRECTORY=$(($(echo $APPC_FEATURES|wc -w)/$FEATURE_DIRECTORY_COUNT))
78
79 APPC_VERSION=${APPC_VERSION:-0.0.1}
80 APPC_OAM_VERSION=${APPC_OAM_VERSION:-0.1.1}
81 AAF_SHIRO_VERSION=${AAF_SHIRO_VERSION:-2.1.0-SNAPSHOT}
82
83 if [ ! -d ${targetDir} ]
84 then
85   mkdir -p ${targetDir}
86 fi
87
88 cwd=$(pwd)
89
90 mavenOpts="-s ${SETTINGS_FILE} -gs ${GLOBAL_SETTINGS_FILE}"
91 cd /tmp
92
93 echo "Installing APP-C version ${APPC_VERSION}"
94
95 #The math for splitting up the features into folders
96 featureNumber=1
97 featureDirNumber=1
98 for feature in ${APPC_FEATURES}
99 do
100 if (( $featureDirNumber < $FEATURE_DIRECTORY_COUNT ))
101 then
102   if (( $featureNumber > $FEATURES_PER_DIRECTORY ))
103   then
104     featureDirNumber=$(($featureDirNumber+1))
105     featureNumber=1
106   fi
107 fi
108
109  rm -f /tmp/${feature}-installer*.zip
110  mvn -U ${mavenOpts} org.apache.maven.plugins:maven-dependency-plugin:2.9:copy -Dartifact=org.onap.appc:${feature}-installer:${APPC_VERSION}:zip -DoutputDirectory=/tmp -Dmaven.wagon.http.ssl.allowall=true -Dmaven.wagon.ssl.insecure=true
111  unzip -d ${featureDir}$featureDirNumber /tmp/${feature}-installer*zip
112 featureNumber=$(($featureNumber+1))
113 done
114
115 echo "Installing platform-logic for APP-C"
116 rm -f /tmp/platform-logic-installer*.zip
117 mvn -U ${mavenOpts} org.apache.maven.plugins:maven-dependency-plugin:2.9:copy -Dartifact=org.onap.appc.deployment:platform-logic-installer:${APPC_OAM_VERSION}:zip -DoutputDirectory=/tmp -Dmaven.wagon.http.ssl.allowall=true -Dmaven.wagon.ssl.insecure=true
118 unzip -d ${targetDir} /tmp/platform-logic-installer*.zip
119
120 echo "Downloading dg-loader-provider jar from nexus"
121 mvn -U ${mavenOpts} org.apache.maven.plugins:maven-dependency-plugin:2.9:copy -Dartifact=org.onap.appc.plugins:dg-loader-provider:${APPC_VERSION}:jar:jar-with-dependencies -DoutputDirectory=${targetDir}/data
122 mv ${targetDir}/data/dg-loader-provider-*-jar-with-dependencies.jar ${targetDir}/data/dg-loader-provider-jar-with-dependencies.jar
123
124 echo "Downloading aaf-cadi-shiro from nexus"
125 mvn -U ${mavenOpts} org.apache.maven.plugins:maven-dependency-plugin:2.9:copy -Dartifact=org.onap.aaf.authz:aaf-shiro-aafrealm-osgi-bundle:${AAF_SHIRO_VERSION} -DoutputDirectory=${targetDir}/data
126 mv ${targetDir}/data/aaf-shiro-aafrealm-osgi-bundle-*.jar ${targetDir}/data/aaf-shiro-aafrealm-osgi-bundle.jar
127
128 find ${targetDir} -name '*.sh' -exec chmod +x '{}' \;
129
130 cd $cwd
131