Index: gs3-extensions/i-jetty/trunk/src/DEX-TO-SDCARD.sh
===================================================================
--- gs3-extensions/i-jetty/trunk/src/DEX-TO-SDCARD.sh	(revision 23882)
+++ gs3-extensions/i-jetty/trunk/src/DEX-TO-SDCARD.sh	(revision 23882)
@@ -0,0 +1,22 @@
+#!/bin/bash
+
+if [ ! -d $SDCARD_GSDL3HOME ] ; then
+  # First time install has been run => do a full copy
+  mode="Installing"
+
+else
+  # Only need to regenerate 'lib' folder
+  mode="Updating"
+fi
+
+echo "#---"
+echo "# $mode Android servlet version to "
+echo "#   $SDCARD_GSDL3HOME/WEB-INF/lib"
+echo "#---"
+echo ""
+
+if [ -d $SDCARD_GSDL3HOME/WEB-INF/lib ] ; then
+  /bin/rm -rf $SDCARD_GSDL3HOME/WEB-INF/lib 
+fi
+
+/bin/cp -r lib $SDCARD_GSDL3HOME/WEB-INF/.
Index: gs3-extensions/i-jetty/trunk/src/JAVA-TO-DEX.sh
===================================================================
--- gs3-extensions/i-jetty/trunk/src/JAVA-TO-DEX.sh	(revision 23882)
+++ gs3-extensions/i-jetty/trunk/src/JAVA-TO-DEX.sh	(revision 23882)
@@ -0,0 +1,117 @@
+#!/bin/bash
+
+
+
+JARS="LuceneWrapper.jar 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"
+
+
+#---
+# 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
+
+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 "Topping up 'jars' with Android specific jars"
+/bin/cp -r 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
+
+#---
+# 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 "Run ./DEX-INSTALL.sh to install/refresh Greenstone on the Android device"
+echo ""
Index: gs3-extensions/i-jetty/trunk/src/WEBAPP-ROOT-TO-SDCARD.sh
===================================================================
--- gs3-extensions/i-jetty/trunk/src/WEBAPP-ROOT-TO-SDCARD.sh	(revision 23882)
+++ gs3-extensions/i-jetty/trunk/src/WEBAPP-ROOT-TO-SDCARD.sh	(revision 23882)
@@ -0,0 +1,64 @@
+#!/bin/bash
+
+if [ ! -d $SDCARD_GSDL3HOME ] ; then
+  # First time install has been run => do a full copy
+  mode="Installing"
+
+else
+  # Only need to regenerate 'lib' folder
+  mode="Updating"
+fi
+
+echo "#---"
+echo "# $mode $GSDL3HOME -> $SDCARD_GSDL3HOME"
+if [ $mode = "Installing" ] ; then
+  echo "# (this may take several minutes)"
+  echo "#---"
+  echo ""
+  (cd $GSDL3HOME && find . -type d ) \
+    | egrep -v '/\.svn' \
+    | egrep -v 'sites/' \
+    | egrep -v 'WEB-INF/classes' \
+    | egrep -v 'WEB-INF/lib' \
+    | xargs -I {} mkdir -p $SDCARD_GSDL3HOME/{}
+else 
+  echo "#---"
+  echo ""
+fi
+
+
+(cd $GSDL3HOME && find . -type f ) \
+  | egrep -v '/\.svn' \
+  | egrep -v 'sites/' \
+  | egrep -v 'WEB-INF/classes' \
+  | egrep -v 'WEB-INF/lib' \
+  | xargs -I {} /bin/cp -u -v $GSDL3HOME/{} $SDCARD_GSDL3HOME/{}
+
+
+#    | echo /bin/cp -u -v  {} $SDCARD_GSDL3HOME
+
+
+##  /bin/cp -v -r $GSDL3HOME $SDCARD_GSDL3HOME 
+
+#  dirs_without_sites=`ls -dF $GSDL3HOME/* | egrep '/$' | egrep -v '/sites/$'`
+#  files_without_sites=`ls -dF $GSDL3HOME/* | egrep -v '/$'`
+
+#  dirs_without_sites=`find $GSDL3HOME -type -d -print | egrep -v '^sites$' | egrep -v '^\.svn$'`
+#  for f in $dirs_without_sites ; do
+#    find WEB-INF/classes
+#    /bin/cp -u -v -r $GSDL3HOME/$f $SDCARD_GSDL3HOME 
+#  done
+
+  if [ ! -d $SDCARD_GSDL3HOME/sites/localsite ] ; then
+    echo "Creating 'localsite' in $SDCARD_GSDLHOME"
+    mkdir $SDCARD_GSDL3HOME/sites/localsite
+  fi
+
+  /bin/cp -u -v -r $GSDL3HOME/sites/no-jni/* $SDCARD_GSDL3HOME/sites/localsite/.
+
+
+#  # No need for .svn files
+#  find $SDCARD_GSDL3HOME -type d -name ".svn" -exec /bin/rm {} \;
+
+#  /bin/rm -rf $SDCARD_GSDL3HOME/WEB-INF/classes
+
Index: gs3-extensions/i-jetty/trunk/src/setup.bash
===================================================================
--- gs3-extensions/i-jetty/trunk/src/setup.bash	(revision 23882)
+++ gs3-extensions/i-jetty/trunk/src/setup.bash	(revision 23882)
@@ -0,0 +1,66 @@
+
+export IJETTY_HOME=`pwd`
+export IJOS=`uname | sed 's/^cygwin.*$/cygwin/i'`
+
+if [ "x$GSDL3HOME" = "x" ] ; then
+  echo "Setting GSDL3HOME to '../../web'"
+  export GSDL3HOME=../../web
+else 
+  echo "Using existing value of GSDL3HOME: '$GSDL3HOME'"
+fi
+
+if [ "x$SDCARD_WEBAPPS" = "x" ] ; then
+
+  if [ "x$IJOS" = "xcygwin" ] ; then
+
+    possible_drives=`ls -d /cygdrive/*/jetty/webapps 2>/dev/null`
+    num_possible_drives=`echo $possible_drives | wc -l`
+
+    if [ $num_possible_drives = "0" ] ; then
+      echo "    Failed to automatically find and sdcard webapps folders"
+      echo "    Explicitly set the environment variable SDCARD_WEBAPPS to control"
+      echo "      installation on the Android phone"   
+    else 
+      if [ $num_possible_drives = "1" ] ; then
+        export SDCARD_WEBAPPS=${possible_drives[0]}
+      else
+        echo "    Detected more than one possible sdcard webapps folders:"
+        echo "      $possible_drives"
+        echo "    Explicitly set the environment variable SDCARD_WEBAPPS to control"
+        echo "      which one is used for installation on the Android phone"   
+      fi
+    fi
+  fi
+fi
+
+if [ "x$SDCARD_WEBAPPS" != "x" ] ; then
+  export SDCARD_GSDL3HOME=$SDCARD_WEBAPPS/greenstone3/
+  echo ""
+  echo "  Using:"
+  echo "     $SDCARD_GSDL3HOME"
+  echo "  as the installation point for the Greenstone servlet"
+  echo ""
+fi
+
+
+if [ "x$IJETTY_PORT" = "x" ] ; then
+  export IJETTY_PORT=8080
+  echo ""
+  echo "  Setting IJETTY_PORT to 8080"
+  echo "  Explicityly set this environment variable to override this default"
+  echo ""
+else
+  echo ""
+  echo "  Using IJETTY PORT = $IJETTY_PORT"
+  echo ""
+fi
+
+echo "+ Your environment has now been set up with iJetty extension for Greenstone"
+
+if [ "x$ANDROID_HOME" = "x" ] ; then
+  export ANDROID_HOME=/cygdrive/c/Program\ Files/Android\ SDK/android-sdk-windows
+  export PATH=$ANDROID_HOME/tools:$ANDROID_HOME/platform-tools:$PATH
+
+  echo "+ Your environment has now been set up to run the Android SDK"
+fi
+
Index: gs3-extensions/i-jetty/trunk/src/setup.bat
===================================================================
--- gs3-extensions/i-jetty/trunk/src/setup.bat	(revision 23882)
+++ gs3-extensions/i-jetty/trunk/src/setup.bat	(revision 23882)
@@ -0,0 +1,13 @@
+@echo off
+
+pushd "%CD%"
+CD /D "%~dp0"
+set IJETTY_HOME=%CD%
+popd
+
+set ANDROID_HOME=C:\Program Files\Android SDK\android-sdk-windows
+
+set PATH=%ANDROID_HOME%\tools;%ANDROID_HOME%\platform-tools;%PATH%
+
+echo + Your environment has now been set up to run the Android SDK
+
