88#
99# Use this setup.sh script to unzip the bwce-runitme zip while creating the base image.
1010
11+ # Variables coming from TCI scripts
12+ TCI_BW_EDITION=$1
13+ TCI_HOME=$2
14+ CLOUD_VERSION=$3
15+ BWCE_HOME=$4
16+
17+ echo " INFO Variables received :" $TCI_BW_EDITION , $TCI_HOME , $CLOUD_VERSION , $BWCE_HOME
18+
1119print_Debug ()
1220{
1321 if [[ ${BW_LOGLEVEL} && " ${BW_LOGLEVEL,,} " = " debug" ]]; then
1422 echo $1
1523 fi
1624}
25+
1726extract ()
1827{
1928if [ -f $1 ] ; then
@@ -63,7 +72,7 @@ checkProfile()
6372 for name in $( find $BUILD_DIR -path $BUILD_DIR /tibco.home -prune -o -type f -iname " *.jar" ) ;
6473 do
6574 if [[ $name == * .jar ]]; then
66- mkdir -p $BUILD_DIR /temp
75+ mkdir -p $BUILD_DIR /temp
6776 unzip -o -q $name -d $BUILD_DIR /temp
6877 MANIFESTMF=$BUILD_DIR /temp/META-INF/MANIFEST.MF
6978
@@ -95,8 +104,7 @@ checkProfile()
95104 defaultProfile=$x ;;esac
96105 done
97106
98- if [ -z ${BW_PROFILE:= ${defaultProfile} } ]; then
99- echo " BW_PROFILE is unset. Set it to $defaultProfile " ;
107+ if [ -z ${BW_PROFILE:= ${defaultProfile} } ]; then echo " BW_PROFILE is unset. Set it to $defaultProfile " ;
100108 else
101109 case $BW_PROFILE in
102110 * .substvar ) ;;
@@ -139,7 +147,6 @@ setLogLevel()
139147 fi
140148}
141149
142-
143150checkEnvSubstituteConfig ()
144151{
145152 bwappnodeTRA=$BWCE_HOME /tibco.home/bw* /* /bin/bwappnode.tra
@@ -148,7 +155,7 @@ checkEnvSubstituteConfig()
148155 manifest=/tmp/META-INF/MANIFEST.MF
149156 bwAppNameHeader=" Bundle-SymbolicName"
150157 bwBundleAppName=` while read line; do printf " %q\n" " $line " ; done< ${manifest} | awk ' /.*:/{printf "%s%s", (NR==1)?"":RS,$0;next}{printf "%s", FS $0}END{print ""}' | grep -o $bwAppNameHeader .* | cut -d " :" -f2 | tr -d ' [[:space:]]' | sed " s/\\\\ \r'//g" | sed " s/$'//g" `
151- export BWCE_APP_NAME=$bwBundleAppName
158+ export BWCE_APP_NAME=$bwBundleAppName
152159 if [ -e ${bwappnodeTRA} ]; then
153160 sed -i ' s?-Djava.class.path=?-Djava.class.path=$ADDONS_HOME/lib:?' $bwappnodeTRA
154161 print_Debug " Appended ADDONS_HOME/lib in bwappnode.tra file"
@@ -157,6 +164,7 @@ checkEnvSubstituteConfig()
157164 sed -i ' s?-Djava.class.path=?-Djava.class.path=$ADDONS_HOME/lib:?' $bwappnodeFile
158165 print_Debug " Appended ADDONS_HOME/lib in bwappnode file"
159166 fi
167+
160168 if [[ ${BW_JAVA_OPTS} ]]; then
161169 if [ -e ${bwappnodeTRA} ]; then
162170 sed -i.bak " /java.extended.properties/s/$/ ${BW_JAVA_OPTS} /" $bwappnodeTRA
@@ -216,18 +224,28 @@ checkPlugins()
216224 pluginFolder=/resources/addons/plugins
217225 if [ -d ${pluginFolder} ] && [ " $( ls $pluginFolder ) " ]; then
218226 print_Debug " Adding Plug-in Jars"
219- echo -e " name=Addons Factory\ntype=bw6\nlayout=bw6ext\nlocation=$BWCE_HOME /tibco.home/addons" > ` echo $BWCE_HOME /tibco.home/bw* /* /ext/shared` /addons.link
220-
227+
228+ if [ $TCI_BW_EDITION != " ipaas" ]; then
229+ HOME=$BWCE_HOME /tibco.home
230+ else
231+ HOME=$TCI_HOME /ext/shared
232+ fi
233+
234+ echo -e " name=Addons Factory\ntype=bw6\nlayout=bw6ext\nlocation=$HOME /addons" > ` echo $BWCE_HOME /tibco.home/bw* /* /ext/shared` /addons.link
221235 for name in $( find $pluginFolder -type f) ;
222236 do
223237 # filter out hidden files
224- if [[ " $( basename $name ) " != .* ]]; then
225- unzip -q -o $name -d $BWCE_HOME /plugintmp/
226- mkdir -p $BWCE_HOME /tibco.home/addons/runtime/plugins/ && mv $BWCE_HOME /plugintmp/runtime/plugins/* " $_ "
227- mkdir -p $BWCE_HOME /tibco.home/addons/lib/ && mv $BWCE_HOME /plugintmp/lib/* .ini " $_ " ${name##*/ } .ini
228- mkdir -p $BWCE_HOME /tibco.home/addons/lib/ && mv $BWCE_HOME /plugintmp/lib/* .jar " $_ " 2> /dev/null || true
229- mkdir -p $BWCE_HOME /tibco.home/addons/bin/ && mv $BWCE_HOME /plugintmp/bin/* " $_ " 2> /dev/null || true
230- find $BWCE_HOME /plugintmp/* -type d ! \( -name " runtime" -o -name " bin" -o -name " lib" \) -exec mv {} / \; 2> /dev/null
238+ if [[ " $( basename $name ) " != .* ]]; then
239+ unzip -q -o $name -d $BWCE_HOME /plugintmp/
240+ mkdir -p $HOME /addons/runtime/plugins/ && mv $BWCE_HOME /plugintmp/runtime/plugins/* " $_ "
241+ mkdir -p $HOME /addons/lib/ && mv $BWCE_HOME /plugintmp/lib/* .ini " $_ " ${name##*/ } .ini
242+ mkdir -p $HOME /addons/lib/ && mv $BWCE_HOME /plugintmp/lib/* .jar " $_ " 2> /dev/null || true
243+ mkdir -p $HOME /addons/bin/ && mv $BWCE_HOME /plugintmp/bin/* " $_ " 2> /dev/null || true
244+ if [ $TCI_BW_EDITION != " ipaas" ]; then
245+ find $BWCE_HOME /plugintmp/* -type d ! \( -name " runtime" -o -name " bin" -o -name " lib" \) -exec mv {} /tmp \; 2> /dev/null
246+ else
247+ find $BWCE_HOME /plugintmp/* -type d ! \( -name " runtime" -o -name " bin" -o -name " lib" \) -exec mv {} /opt/tibco \; 2> /dev/null
248+ fi
231249 rm -rf $BWCE_HOME /plugintmp/
232250 fi
233251 done
@@ -283,21 +301,17 @@ checkCerts()
283301checkAgents ()
284302{
285303 agentFolder=/resources/addons/monitor-agents
286-
287304 if [ -d ${agentFolder} ] && [ " $( ls $agentFolder ) " ]; then
288305 print_Debug " Adding monitoring jars"
289-
290306 for name in $( find $agentFolder -type f) ;
291- do
292- # filter out hidden files
293- if [[ " $( basename $name ) " != .* ]]; then
294- mkdir -p $BWCE_HOME /agent/
295- unzip -q $name -d $BWCE_HOME /agent/
296- fi
297- done
298-
307+ do
308+ # filter out hidden files
309+ if [[ " $( basename $name ) " != .* ]]; then
310+ mkdir -p $BWCE_HOME /agent/
311+ unzip -q $name -d $BWCE_HOME /agent/
312+ fi
313+ done
299314 fi
300-
301315}
302316
303317memoryCalculator ()
@@ -337,11 +351,11 @@ checkJavaGCConfig()
337351
338352checkJAVAHOME ()
339353{
340- if [[ ${JAVA_HOME} ]]; then
341- print_Debug $JAVA_HOME
342- else
343- export JAVA_HOME=$BWCE_HOME /tibco.home/tibcojre64/1.8.0
344- fi
354+ if [[ ${JAVA_HOME} ]]; then
355+ print_Debug $JAVA_HOME
356+ else
357+ export JAVA_HOME=$BWCE_HOME /tibco.home/tibcojre64/1.8.0
358+ fi
345359}
346360
347361checkThirdPartyInstallations ()
@@ -415,27 +429,78 @@ then
415429 cp -r /resources/addons/jars/* ` echo $BWCE_HOME /tibco.home/bw* /* ` /system/hotfix/shared
416430 fi
417431 fi
418- ln -s /* .ear ` echo $BWCE_HOME /tibco.home/bw* /* /bin` /bwapp.ear
419- sed -i.bak " s#_APPDIR_#$BWCE_HOME #g" $BWCE_HOME /tibco.home/bw* /* /config/appnode_config.ini
420- unzip -qq ` echo $BWCE_HOME /tibco.home/bw* /* /bin/bwapp.ear` -d /tmp
421- setLogLevel
422- memoryCalculator
423- checkEnvSubstituteConfig
432+ if [ $TCI_BW_EDITION != " ipaas" ]; then
433+ ln -s /* .ear ` echo $BWCE_HOME /tibco.home/bw* /* /bin` /bwapp.ear
434+ sed -i.bak " s#_APPDIR_#$BWCE_HOME #g" $BWCE_HOME /tibco.home/bw* /* /config/appnode_config.ini
435+ unzip -qq ` echo $BWCE_HOME /tibco.home/bw* /* /bin/bwapp.ear` -d /tmp
436+ setLogLevel
437+ memoryCalculator
438+ checkEnvSubstituteConfig
439+ fi
424440fi
425441
426- checkProfile
427- checkPolicy
428- setupThirdPartyInstallationEnvironment
429-
430- if [ -f /* .substvar ]; then
431- cp -f /* .substvar $BWCE_HOME /tmp/pcf.substvar # User provided profile
432- else
433- cp -f /tmp/META-INF/$BW_PROFILE $BWCE_HOME /tmp/pcf.substvar
442+ if [ $TCI_BW_EDITION != " ipaas" ]; then
443+ checkProfile
444+ checkPolicy
445+ setupThirdPartyInstallationEnvironment
446+ if [ -f /* .substvar ]; then
447+ cp -f /* .substvar $BWCE_HOME /tmp/pcf.substvar # User provided profile
448+ else
449+ cp -f /tmp/META-INF/$BW_PROFILE $BWCE_HOME /tmp/pcf.substvar
450+ fi
451+ $JAVA_HOME /bin/java -cp ` echo $BWCE_HOME /tibco.home/bw* /* /system/shared/com.tibco.bwce.profile.resolver_* .jar` :` echo $BWCE_HOME /tibco.home/bw* /* /system/shared/com.tibco.tpcl.com.fasterxml.jackson_* ` /* :` echo $BWCE_HOME /tibco.home/bw* /* /system/shared/com.tibco.bw.tpcl.org.codehaus.jettison_* ` /* :$BWCE_HOME :$JAVA_HOME /lib -DBWCE_APP_NAME=$bwBundleAppName com.tibco.bwce.profile.resolver.Resolver
452+ STATUS=$?
453+ if [ $STATUS == " 1" ]; then
454+ exit 1 # terminate and indicate error
455+ fi
434456fi
435457
436- $JAVA_HOME /bin/java -cp ` echo $BWCE_HOME /tibco.home/bw* /* /system/shared/com.tibco.bwce.profile.resolver_* .jar` :` echo $BWCE_HOME /tibco.home/bw* /* /system/shared/com.tibco.tpcl.com.fasterxml.jackson_* ` /* :` echo $BWCE_HOME /tibco.home/bw* /* /system/shared/com.tibco.bw.tpcl.org.codehaus.jettison_* ` /* :$BWCE_HOME :$JAVA_HOME /lib -DBWCE_APP_NAME=$bwBundleAppName com.tibco.bwce.profile.resolver.Resolver
458+ if [ $TCI_BW_EDITION == " ipaas" ];
459+ then
460+ echo " $( date " +%H:%M:%S.000" ) INFO ######################## Setting up TCI environment start #######################"
461+ tci_java_home=" /usr/lib/jvm/java"
462+ BW_VERSION=` ls $BWCE_HOME /tibco.home/bw* /`
463+
464+ # copy runtime zip in TCI_HOME
465+ if [ -d $BWCE_HOME /tibco.home/bwce/${BW_VERSION} ]; then
466+ yes | cp -r $BWCE_HOME /tibco.home/bwce/${BW_VERSION} /* $TCI_HOME
467+ fi
468+ if [ -d $BWCE_HOME /tibco.home/addons/lib ]; then
469+ yes | cp -r $BWCE_HOME /tibco.home/addons/lib $TCI_HOME /ext/shared
470+ fi
437471
438- STATUS=$?
439- if [ $STATUS == " 1" ]; then
440- exit 1 # terminate and indicate error
472+ echo " $( date " +%H:%M:%S.000" ) INFO Copied runtime zip in TCI home: " $TCI_HOME
473+
474+ # Modify TRA files to use new TCI home = /opt/tibco/bwcloud/<cloudversion>
475+ cd $TCI_HOME /bin
476+
477+ # TODO: check without tra modification
478+ # Modify bwappnode & bwappnode.tra file in runtime zip
479+ echo -e " \nexport TIBCO_JAVA_HOME=${tci_java_home} \ntibco.include.tra=${TCI_HOME} /bin/bwcommon.tra" >> bwappnode
480+ sed -i " s+$APPDIR /tibco.home+/opt/tibco+g" bwappnode
481+ sed -i " s+bwce/${BW_VERSION} +bwcloud/${CLOUD_VERSION} +g" bwappnode
482+
483+ # Change paths in bwcommon.tra file. check if FTL home need to be added in the path
484+ sed -i " s+%APPDIR%/tibco.home+/opt/tibco+g" bwcommon.tra
485+ sed -i " s+tibco.product.folder=bwce/${BW_VERSION} +tibco.product.folder=bwcloud/${CLOUD_VERSION} +g" bwcommon.tra
486+ sed -i ' s+tibco.env.product.type=bwce+tibco.env.product.type=bwcloud+g' bwcommon.tra
487+
488+ # Modify appnode_config.ini
489+ sed -i ' s+osgi.console.ssh=1122+osgi.console=1122+g' $TCI_HOME /config/appnode_config.ini
490+ sed -i ' s+osgi.console.enable.builtin=false+# osgi.console.enable.builtin=false+g' $TCI_HOME /config/appnode_config.ini
491+ sed -i ' s+osgi.console.ssh.useDefaultSecureStorage=true+# osgi.console.ssh.useDefaultSecureStorage=true+g' $TCI_HOME /config/appnode_config.ini
492+ sed -i " s+java.security.auth.login.config=_APPDIR_/tibco.home/bwce/${BW_VERSION} /config/equinox.console.jass.login.conf+# java.security.auth.login.config=_APPDIR_/tibco.home/bwce/${BW_VERSION} /config/equinox.console.jass.login.conf+g" $TCI_HOME /config/appnode_config.ini
493+ sed -i " s+ssh.server.keystore=_APPDIR_/tibco.home/bwce/${BW_VERSION} /repo/hostkey.ser+# ssh.server.keystore=_APPDIR_/tibco.home/bwce/${BW_VERSION} /repo/hostkey.ser+g" $TCI_HOME /config/appnode_config.ini
494+ sed -i " s+org.eclipse.equinox.console.jaas.file=_APPDIR_/tibco.home/bwce/${BW_VERSION} /repo/store+# org.eclipse.equinox.console.jaas.file=_APPDIR_/tibco.home/bwce/${BW_VERSION} /repo/store+g" $TCI_HOME /config/appnode_config.ini
495+ sed -i ' s+org.eclipse.equinox.http.jetty.autostart=true+# org.eclipse.equinox.http.jetty.autostart=true+g' $TCI_HOME /config/appnode_config.ini
496+ sed -i ' s+bw.frwk.event.subscriber.metrics.enabled=false+# bw.frwk.event.subscriber.metrics.enabled=false+g' $TCI_HOME /config/appnode_config.ini
497+ sed -i ' s+_APPDIR_/tibco.home+/opt/tibco+g' $TCI_HOME /config/appnode_config.ini
498+
499+ # Clean up
500+ rm -rf $TCI_HOME /bin/startBWAppNode.sh
501+ rm -rf $TCI_HOME /bin/bwappnode.script.sh
502+ rm -rf $TCI_HOME /bin/bwappnode.tra
503+ echo " $( date " +%H:%M:%S.000" ) INFO ######################## Setting up TCI environment end #######################"
504+
441505fi
506+
0 commit comments