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

Revision 72, 5.1 KB (checked in by vsilva, 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
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/pteid35libJava.jar $BASE_OUTPUT_FOLDER/non_maven_deps/pteid-lib-java-linux.jar
62        LINUX_JAR_MD5=`md5sum ../jar/pteid35libJava.jar | awk '{ print $1 }'`
63
64        echo " Gonna copy LINUX Dependencies"
65        cp -v libcardpluginPteid.so.3.0.1 $1/libcardpluginPteid.so.3
66        cp -v libfreeimagePTEiD-3.15.1.so $1/libfreeimagePTEiD.so.3
67        cp -v libpteidapplayer.so.3.5.5 $1/libpteidapplayer.so.3
68        cp -v libpteidcardlayer.so.3.5.5 $1/libpteidcardlayer.so.3
69        cp -v libpteidcommon.so.3.5.5 $1/libpteidcommon.so.3
70        cp -v libpteiddialogsQT.so.3.5.5 $1/libpteiddialogsQT.so.3
71        cp -v libpteidlib.so.3.5.5 $1/libpteidlib.so.3
72        cp -v libpteidlibJava_Wrapper.so.3.5.5 $1/libpteidlibJava_Wrapper.so
73        cp -v libpteidpkcs11.so.3.5.5 $1/libpteidpkcs11.so.3
74        cp -v libpteidpp2-gempc.so.1.0.0 $1/libpteidpp2-gempc.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        mv -v $1/libpteidlibJava_Wrapper.3.5.5.dylib $1/libpteidlibJava_Wrapper.jnilib
91        MAC_JAR_MD5=`md5sum *.jar | awk '{ print $1 }'`
92
93        echo " Gonna copy the MAC Dependencies"
94        cp -v * $1
95 
96}
97
98#`clear` # A lot of output so we start with a fresh screen
99
100cd $DIST_FOLDER
101LATEST=`ls -t1 | head -n1`
102echo "Using lastest build dating $LATEST"
103cd $LATEST
104
105COUNTER=0
106for DISTRO in ${MWOFFLINE_FOLDERS[*]}
107do
108#       echo "NOW IN `pwd`"
109#       echo "counter is now $COUNTER"
110        if [ -x $DISTRO ] ; then
111                echo "Found $DISTRO"
112                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
113                  prepareExtractFolder
114                  cp "$DISTRO/$LINUX_RELEASE_FILE" "$TEMP_EXTRACT_FOLDER"
115                  cd $TEMP_EXTRACT_FOLDER
116                  tar -xf $LINUX_RELEASE_FILE
117                  cd $LINUX_RELEASE_FOLDER/lib
118                  cpSOsTo "${MWONLINE_FOLDERS[$COUNTER]}"
119                elif [ $COUNTER -lt 4 ] ; then                  # Its a Windows system so we expect dlls in one folder easy peasy
120                  cd $DISTRO
121                  cpDlls "${MWONLINE_FOLDERS[$COUNTER]}"
122                else                                                                    # Mac
123                  cpDylibsTo "${MWONLINE_FOLDERS[$COUNTER]}"
124                fi
125        else
126                echo  "WARNING: Distro $DISTRO not available"
127        fi
128        let COUNTER++
129        cd $DIST_FOLDER/$LATEST
130done
131
132# Getting back to our original place
133cd $MVN_INSTALL_SCRIPT_PATH
134
135mvn_install.sh $WINDOWS_JAR_MD5 $LINUX_JAR_MD5 $MAC_JAR_MD5
136
137echo "done"
Note: See TracBrowser for help on using the browser.