root/middleware-online/trunk/non_maven_deps/getLatestExecutables.sh @ 81

Revision 81, 5.9 KB (checked in by noliveira, 9 years ago)

Developments on Online Application

  • Property svn:executable set to *
Line 
1#!/bin/bash
2
3####################################################################################################################################
4#
5# This script will copy all the latest available releases from the pre-arranged paths on the MW offline to our folders. This is
6# very useful prior to distributing the webapp since the packaging mechanism will use these files as the source for the executable
7# code.
8# On this first section you will find some variables to indicate where the paths and file names are on this system. Configure them
9# accordingly.
10#
11# @author Ricardo Espírito Santo - Linkare TI
12#
13####################################################################################################################################
14
15DIST_FOLDER=~/work/eclipse-workspace/middleware-offline/builds
16LINUX_32_FOLDER_NAME=caixamagica-16-32
17LINUX_64_FOLDER_NAME=caixamagica-16-64
18LINUX_RELEASE_FILE=pteid-pkg-web.tar.gz
19LINUX_RELEASE_FOLDER=pteid-pkg
20WINDOWS_32_FOLDER_NAME=win32-libs
21WINDOWS_64_FOLDER_NAME=win64-libs
22MAC_FOLDER_NAME=macos/online
23
24BASE_OUTPUT_FOLDER=~/work/eclipse-workspace/middleware-online
25LINUX_32_FOLDER_OUTPUT=$BASE_OUTPUT_FOLDER/nativelib-linux-x86/src/main/resources
26LINUX_64_FOLDER_OUTPUT=$BASE_OUTPUT_FOLDER/nativelib-linux-amd64/src/main/resources
27WINDOWS_32_FOLDER_OUTPUT=$BASE_OUTPUT_FOLDER/nativelib-windows-x86/src/main/resources
28WINDOWS_64_FOLDER_OUTPUT=$BASE_OUTPUT_FOLDER/nativelib-windows-amd64/src/main/resources
29MAC_FOLDER_OUTPUT=$BASE_OUTPUT_FOLDER/nativelib-macosx-universal/src/main/resources
30
31
32TEMP_EXTRACT_FOLDER=/tmp
33
34####################################################################################################################################
35#
36# Do not Change bellow this line
37#
38######################################################################################################################################
39
40MVN_INSTALL_SCRIPT_PATH=`pwd`
41
42LINUX_JAR_MD5=0
43WINDOWS_JAR_MD5=0
44MAC_JAR_MD5=0
45
46# NOTE that order here matters since we will match these folders with the ones where we copy our libs to
47MWOFFLINE_FOLDERS=("$LINUX_32_FOLDER_NAME" "$LINUX_64_FOLDER_NAME" "$WINDOWS_32_FOLDER_NAME" "$WINDOWS_64_FOLDER_NAME" "$MAC_FOLDER_NAME")
48# This is the list of folders to where we are copying the libraries
49MWONLINE_FOLDERS=("$LINUX_32_FOLDER_OUTPUT" "$LINUX_64_FOLDER_OUTPUT" "$WINDOWS_32_FOLDER_OUTPUT" "$WINDOWS_64_FOLDER_OUTPUT" "$MAC_FOLDER_OUTPUT")
50
51# AGAIN ORDER DOES MATTER
52FILES_TO_COPY=()
53FILES_COPIED=()
54
55function prepareExtractFolder {
56        rm -rf $TEMP_EXTRACT_FOLDER/$LINUX_RELEASE_FOLDER
57}
58
59function cpSOsTo {
60        echo " Gonna copy the LINUX JAR file"
61        cp -v ../jar/*.jar $BASE_OUTPUT_FOLDER/non_maven_deps/pteid-lib-java-linux.jar
62        LINUX_JAR_MD5=`md5sum ../jar/*.jar | awk '{ print $1 }'`
63
64        echo " Gonna copy LINUX Dependencies"
65        cp -v libcardpluginPteid.so.2.0.0 $1/libcardpluginPteid.so.2
66        cp -v libfreeimagePTEiD-3.15.1.so $1/libfreeimagePTEiD.so.2
67        cp -v libpteidapplayer.so.2.0.0 $1/libpteidapplayer.so.2
68        cp -v libpteidcardlayer.so.2.0.0 $1/libpteidcardlayer.so.2
69        cp -v libpteidcommon.so.2.0.0 $1/libpteidcommon.so.2
70        cp -v libpteiddialogsQT.so.2.0.0 $1/libpteiddialogsQT.so.2
71        cp -v libpteidlib.so.2.0.0 $1/libpteidlib.so.2
72        cp -v libpteidlibJava_Wrapper.so.2.0.0 $1/libpteidlibJava_Wrapper.so
73        cp -v libpteidpp2-gempc.so.1.0.0 $1/libpteidpp2-gempc.so.1.0.0
74    cp -v libpteidpp2-acr83.so.1.0.0 $1/libpteidpp2-acr83.so.1.0.0
75        cp -v libxml-security-c.so.16.0.1 $1/libxml-security-c.so.16
76}
77
78function cpDlls {
79        echo " Copying the WINDOWS JAR file"
80        cp -v *.jar $BASE_OUTPUT_FOLDER/non_maven_deps/pteid-lib-java-windows.jar
81        WINDOWS_JAR_MD5=`md5sum *.jar | awk '{ print $1 }'`
82
83        echo " Gonna copy the WINDOWS Dependencies"
84        cp -v *.dll $1
85}
86
87function cpDylibsTo {
88        echo " Copying the MAC JAR file"
89        cp -v *.jar $BASE_OUTPUT_FOLDER/non_maven_deps/pteid-lib-java-mac.jar
90        MAC_JAR_MD5=`md5sum *.jar | awk '{ print $1 }'` 
91
92        echo " Gonna copy the MAC Dependencies"
93        cp -v libcardpluginPteid.2.0.0.dylib $1/libcardpluginPteid.2.0.0.dylib
94        cp -v libfreeimagePTEiD-3.15.1.dylib-x86_64 $1/libfreeimagePTEiD-3.15.1.dylib-x86_64
95        cp -v libpteidapplayer.2.0.0.dylib $1/libpteidapplayer.2.0.0.dylib
96        cp -v libpteidcardlayer.2.0.0.dylib $1/libpteidcardlayer.2.0.0.dylib
97        cp -v libpteidcommon.2.0.0.dylib $1/libpteidcommon.2.0.0.dylib
98        cp -v libpteiddialogsQT.2.0.0.dylib $1/libpteiddialogsQT.2.0.0.dylib
99        cp -v libpteidlib.2.0.0.dylib $1/libpteidlib.2.0.0.dylib
100        cp -v libpteidlibJava_Wrapper.2.0.0.dylib $1/libpteidlibJava_Wrapper.jnilib
101        #cp -v libpteidlibJava_Wrapper.dylib $1/libpteidlibJava_Wrapper.dylib
102        cp -v libpteidpp2-gempc.1.0.0.dylib $1/libpteidpp2-gempc.1.0.0.dylib
103        cp -v libpteidpp2-acr83.1.0.0.dylib $1/libpteidpp2-acr83.1.0.0.dylib
104        cp -v libxml-security-c.16.dylib $1/libxml-security-c.16.dylib
105
106        cp -v libxerces-c-3.1.dylib $1/libxerces-c-3.1.dylib
107        cp -v libcurl.4.dylib $1/libcurl.4.dylib
108}
109
110#`clear` # A lot of output so we start with a fresh screen
111
112cd $DIST_FOLDER
113LATEST=`ls -t1 | head -n1`
114echo "Using lastest build dating $LATEST"
115cd $LATEST
116
117COUNTER=0
118for DISTRO in ${MWOFFLINE_FOLDERS[*]}
119do
120#       echo "NOW IN `pwd`"
121#       echo "counter is now $COUNTER"
122        if [ -x $DISTRO ] ; then
123                echo "Found $DISTRO"
124                if [ $COUNTER -lt 2 ] ; then                    # Ouch its a linux we have to extract the tar.gz file and then copy all the right SO files
125                  prepareExtractFolder
126                  cp "$DISTRO/$LINUX_RELEASE_FILE" "$TEMP_EXTRACT_FOLDER"
127                  cd $TEMP_EXTRACT_FOLDER
128                  tar -xf $LINUX_RELEASE_FILE
129                  cd $LINUX_RELEASE_FOLDER/lib
130                  cpSOsTo "${MWONLINE_FOLDERS[$COUNTER]}"
131                elif [ $COUNTER -lt 4 ] ; then                  # Its a Windows system so we expect dlls in one folder easy peasy
132                  cd $DISTRO
133                  cpDlls "${MWONLINE_FOLDERS[$COUNTER]}"
134                else                                                                    # Mac
135                  cd $DISTRO
136                  cpDylibsTo "${MWONLINE_FOLDERS[$COUNTER]}"
137                fi
138        else
139                echo  "WARNING: Distro $DISTRO not available"
140        fi
141        let COUNTER++
142        cd $DIST_FOLDER/$LATEST
143done
144
145# Getting back to our original place
146cd $MVN_INSTALL_SCRIPT_PATH
147
148mvn_install.sh $WINDOWS_JAR_MD5 $LINUX_JAR_MD5 $MAC_JAR_MD5
149
150echo -e "\033[30m done"
Note: See TracBrowser for help on using the browser.