#!/bin/bash if [ "x$SDCARD_WEBAPPS" = "x" ] ; then echo "Environment variable SDCARD_WEBAPPS undefined" echo " => No valid directory to install to on Android device" echo " => Did you run setup.bash before the Android device was in disk mode?" echo " => Alternatively, set the environment variable explicitly" exit -1 fi JARS="axis.jar commons-lang3-3.0-beta.jar cp.jar \ gsdl3.jar gutil.jar \ jdbm.jar js.jar serializer.jar \ xercesImpl.jar xml-apis.jar" # LuceneWrapper.jar and xalan.jar used to be in the list, # but are now in modified-jars. See README.txt in that # directory for details #--- # Copy GS3 classes files to I-Jetty classes #--- if [ -d classes ] ; then echo "#---" echo "# Regenerating directory: classes" echo "#---" /bin/rm -rf classes fi echo "#---" echo "# Copying Greenstone-3 classes to the I-Jetty extension" /bin/cp -rf "$GSDL3HOME/WEB-INF/classes" classes /bin/rm -rf classes/.svn echo "# Setting GSDL3HOME to match SD-Card on Android device" echo "#---" if [ "x$IJOS" = "xcygwin" ] ; then SDCARD_GSDL3HOME_ONDEVICE=`echo $SDCARD_GSDL3HOME | sed 's@^/cygdrive/./@/sdcard/@'` else echo "Need to change mapped location of Android device on host machine" echo "But no support currently implemented for: $IJOS" SDCARD_GSDL3HOME_ONDEVICE=$SDCARD_GSDL3HOME fi cat classes/global.properties \ | sed "s@^gsdl3\.home=.*@gsdl3.home=$SDCARD_GSDL3HOME_ONDEVICE@" \ | sed "s@^tomcat\.port=.*@tomcat.port=$IJETTY_PORT@" \ > classes/global.properties.android /bin/mv classes/global.properties.android classes/global.properties cat classes/log4j.properties \ | sed "s@^gsdl3\.home=.*@gsdl3.home=$SDCARD_GSDL3HOME_ONDEVICE@" \ > classes/log4j.properties.android /bin/mv classes/log4j.properties.android classes/log4j.properties #--- # Copy selected GS3 Jar files to I-Jetty jars #--- echo "#---" if [ -d jars ] ; then echo "# Regenerating jars" /bin/rm -rf jars else echo "# Generating jars" fi echo "#---" mkdir jars for f in $JARS ; do echo " Copying from Greenstone-3 to I-Jetty: $f" /bin/cp "$GSDL3HOME/WEB-INF/lib/$f" jars/. done echo "Overriding existings Greenstone jars with ones that needed tweaking for Android" /bin/cp -v modified-jars/* jars/. echo "Topping up 'jars' with Android specific jars" /bin/cp -v extra-jars/* jars/. #--- # Generate dex file in I-Jetty 'classes' directory #--- # If need more memory, add # -JXmx1024M OUTPUT_DEX=$IJETTY_HOME/classes/classes.dex INPUT_DIR=$IJETTY_HOME/jars if [ "x$IJOS" = "xcygwin" ] ; then OUTPUT_DEX=`cygpath -w $OUTPUT_DEX` INPUT_DIR=`cygpath -w $INPUT_DIR` fi # add --verbose for more information dx.bat --dex --core-library --positions=lines --output=$OUTPUT_DEX $INPUT_DIR if [ $? != 0 ] ; then echo "Error(s) encountered when running 'dx'" exit fi #--- # Zip up I-Jetty classes directory and put it in lib #--- echo "#---" if [ -d lib ] ; then echo "# Regenerating directory: lib" /bin/rm -rf lib else echo "# Generating directory: lib" fi echo "#---" mkdir lib echo "#---" echo "Zipping up I-Jetty 'classes' and storing in 'lib'" echo "#---" (cd classes && zip -r ../lib/classes.zip . && cd ..) echo "" echo "####" echo "# Run ./DEX-TO-SDCARD.sh to install the latest DEX files on the device" echo "####" echo ""