Index: /gs3-extensions/i-jetty/trunk/src/DEX-TO-PREPARED-SDCARD.sh
===================================================================
--- /gs3-extensions/i-jetty/trunk/src/DEX-TO-PREPARED-SDCARD.sh	(revision 25622)
+++ /gs3-extensions/i-jetty/trunk/src/DEX-TO-PREPARED-SDCARD.sh	(revision 25623)
@@ -25,2 +25,15 @@
 
 /bin/cp -r lib $PREPARE_SDCARD_GSDL3HOME/WEB-INF/.
+
+#SRC_DIR=$PREPARE_SDCARD_GSDL3HOME 
+#DST_DIR=$WITHIN_SDCARD_GSDL3HOME
+#if [ "x$IJOS" = "xcygwin" ] ; then
+#  SRC_DIR=`cygpath -w $SRC_DIR`
+#  DST_DIR=`cygpath -w $DST_DIR`
+#elif [ "x$IJOS" = "xmingw" ] ; then
+#  SRC_DIR=`echo $SRC_DEX | sed 's/^\/\(.\)/\1:/' | sed 's@/@\\\\@g'`
+#  DST_DIR=`echo $DST_DIR | sed 's/^\/\(.\)/\1:/' | sed 's@/@\\\\@g'`
+#fi
+
+
+adb push war/greenstone3 "$WITHIN_SDCARD_GSDL3HOME"
Index: /gs3-extensions/i-jetty/trunk/src/IJETTY-PUSH.sh
===================================================================
--- /gs3-extensions/i-jetty/trunk/src/IJETTY-PUSH.sh	(revision 25623)
+++ /gs3-extensions/i-jetty/trunk/src/IJETTY-PUSH.sh	(revision 25623)
@@ -0,0 +1,20 @@
+#!/bin/bash
+
+if [ "x$PREPARE_SDCARD_GSDL3HOME" = "x" ] ; then
+  echo "Environment variable PREPARE_SDCARD_GSDL3HOME undefined" 1>&2
+  echo "Have you source setup.bash?" 1>&2
+  exit -1
+fi
+
+if [ $# = "0" ] ; then
+  within_webapps="greenstone3"
+elif [ $# = "1" ] ; then
+  within_webapps=${1#webapps/}
+else
+  echo "Error: too many arguments" 1>&2
+  echo "Usage: $0 webapps-dir" 1>&2
+  exit -1
+fi
+
+echo "Running: adb push \"webapps/$within_webapps\" \"$WITHIN_SDCARD_WEBAPPS/$within_webapps\""
+adb push "webapps/$within_webapps" "$WITHIN_SDCARD_WEBAPPS/$within_webapps"
Index: /gs3-extensions/i-jetty/trunk/src/PREPARE-JAVA-TO-DEX.sh
===================================================================
--- /gs3-extensions/i-jetty/trunk/src/PREPARE-JAVA-TO-DEX.sh	(revision 25622)
+++ /gs3-extensions/i-jetty/trunk/src/PREPARE-JAVA-TO-DEX.sh	(revision 25623)
@@ -2,5 +2,5 @@
 
 if [ "x$PREPARE_SDCARD_GSDL3HOME" = "x" ] ; then
-  echo "Environment variable PREPARE_SDCARD_GSDL3HOME undefined"
+  echo "Environment variable PREPARE_SDCARD_GSDL3HOME undefined" 1>&2
   exit -1
 fi
@@ -35,6 +35,6 @@
 echo "#---"
 
-if [ "x$IJOS" = "xcygwin" ] ; then
-  SDCARD_GSDL3HOME_ONDEVICE=`echo $SDCARD_GSDL3HOME | sed 's@^/.\+/war/@/sdcard/@'`
+if [ "x$IJOS" = "xcygwin" -o "x$IJOS" = "xmingw" ] ; then
+  SDCARD_GSDL3HOME_ONDEVICE=`echo $PREPARE_SDCARD_GSDL3HOME | sed 's@^/.\+/war/@/sdcard/jetty/webapps/@'`
 else 
   echo "Need to change mapped location of Android device on host machine" 
@@ -95,12 +95,19 @@
 INPUT_DIR=$IJETTY_HOME/jars
 
+dxcmd="dx"
 
 if [ "x$IJOS" = "xcygwin" ] ; then
   OUTPUT_DEX=`cygpath -w $OUTPUT_DEX`
   INPUT_DIR=`cygpath -w $INPUT_DIR`
+  dxcmd="dx.bat"
+elif [ "x$IJOS" = "xmingw" ] ; then
+  OUTPUT_DEX=`echo $OUTPUT_DEX | sed 's/^\/\(.\)/\1:/' | sed 's@/@\\\\@g'`
+  INPUT_DIR=`echo $INPUT_DIR | sed 's/^\/\(.\)/\1:/' | sed 's@/@\\\\@g'`
+  dxcmd="cmd /c dx.bat"
 fi
 
 # add --verbose for more information
-dx.bat --verbose --dex --core-library --positions=lines --output=$OUTPUT_DEX $INPUT_DIR
+$dxcmd --verbose --dex --core-library --positions=lines --output=$OUTPUT_DEX $INPUT_DIR
+
 ##dx.bat --dex --core-library --positions=lines --output=$OUTPUT_DEX $INPUT_DIR
 
@@ -129,8 +136,29 @@
 (cd classes && zip -r ../lib/classes.zip . && cd ..)
 
+if [ $? != 0 ] ; then
+  echo "Error(s) encountered zipping up dexified 'lib' files"
+  exit 
+fi
+
+
+
+echo "#---"
+echo "# Copying dexified 'lib' servlet code to "
+echo "#   $PREPARE_SDCARD_GSDL3HOME/WEB-INF/lib"
+echo "#---"
+echo ""
+
+if [ -d $PREPARE_SDCARD_GSDL3HOME/WEB-INF/lib ] ; then
+  /bin/rm -rf $PREPARE_SDCARD_GSDL3HOME/WEB-INF/lib 
+fi
+
+/bin/cp -r lib $PREPARE_SDCARD_GSDL3HOME/WEB-INF/.
+
+
 
 echo ""
 echo "####"
-echo "# Run ./DEX-TO-SDCARD.sh to install the latest DEX files on the device"
+echo "# Run ./IJETTY-PUSH.sh \"webapps\" to install all the files needed on the Andorid device"
+echo "# Run ./IJETTY-PUSH.sh \"webapps/WEB-INF/lib\" to install the latest DEX files on the device"
 echo "####"
 echo ""
Index: 3-extensions/i-jetty/trunk/src/PREPARE-WEBAPP-ROOT-FOR-SDCARD.sh
===================================================================
--- /gs3-extensions/i-jetty/trunk/src/PREPARE-WEBAPP-ROOT-FOR-SDCARD.sh	(revision 25622)
+++ 	(revision )
@@ -1,64 +1,0 @@
-#!/bin/bash
-
-if [ ! -d $PREPARE_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 -> $PREPARE_SDCARD_GSDL3HOME"
-echo "# (this may take several minutes)"
-echo "#---"
-echo ""
-
-if [ $mode = "Installing" ] ; then
-  (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 $PREPARE_SDCARD_GSDL3HOME/{}
-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/{} $PREPARE_SDCARD_GSDL3HOME/{}
-
-/bin/cp resources/index.html $PREPARE_SDCARD_GSDL3HOME/.
-/bin/cp resources/web.xml $PREPARE_SDCARD_GSDL3HOME/WEB-INF/.
-
-if [ ! -d $PREPARE_SDCARD_GSDL3HOME/sites/localsite ] ; then
-  echo "Creating 'localsite' in $PREPARE_SDCARD_GSDLHOME"
-  mkdir $PREPARE_SDCARD_GSDL3HOME/sites/localsite
-  mkdir $PREPARE_SDCARD_GSDL3HOME/sites/localsite/collect
-fi
-
-/bin/cp -u -v $GSDL3HOME/sites/localsite/siteConfig.xml $PREPARE_SDCARD_GSDL3HOME/sites/localsite/.
-
-/bin/cp -u -v -r $GSDL3HOME/sites/localsite/etc $PREPARE_SDCARD_GSDL3HOME/sites/localsite/.
-
-/bin/cp -u -v -r $GSDL3HOME/sites/localsite/collect/lucene-jdbm-demo $PREPARE_SDCARD_GSDL3HOME/sites/localsite/collect/.
-
-if [ ! -d $PREPARE_SDCARD_GSDL3HOME/sites/localsite/collect/lucene-jdbm-demo/index ] ; then
-  pushd $PREPARE_SDCARD_GSDL3HOME/sites/localsite/collect/lucene-jdbm-demo
-  unzip index.zip
-  popd
-fi
-
-echo ""
-echo "####"
-echo "# If not already done so, run: "
-echo "#   ./JAVA-TO-DEX.sh"
-echo "# to cross-compile the Greenstone code and supporting JAR files"
-echo "####"
-echo ""
-
-
-
Index: /gs3-extensions/i-jetty/trunk/src/PREPARE-WEBAPPS-GREENSTONE-ROOT-FOR-IJETTY.sh
===================================================================
--- /gs3-extensions/i-jetty/trunk/src/PREPARE-WEBAPPS-GREENSTONE-ROOT-FOR-IJETTY.sh	(revision 25623)
+++ /gs3-extensions/i-jetty/trunk/src/PREPARE-WEBAPPS-GREENSTONE-ROOT-FOR-IJETTY.sh	(revision 25623)
@@ -0,0 +1,64 @@
+#!/bin/bash
+
+if [ ! -d $PREPARE_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 -> $PREPARE_SDCARD_GSDL3HOME"
+echo "# (this may take several minutes)"
+echo "#---"
+echo ""
+
+if [ $mode = "Installing" ] ; then
+  (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 $PREPARE_SDCARD_GSDL3HOME/{}
+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/{} $PREPARE_SDCARD_GSDL3HOME/{}
+
+/bin/cp resources/index.html $PREPARE_SDCARD_GSDL3HOME/.
+/bin/cp resources/web.xml $PREPARE_SDCARD_GSDL3HOME/WEB-INF/.
+
+if [ ! -d $PREPARE_SDCARD_GSDL3HOME/sites/localsite ] ; then
+  echo "Creating 'localsite' in $PREPARE_SDCARD_GSDLHOME"
+  mkdir $PREPARE_SDCARD_GSDL3HOME/sites/localsite
+  mkdir $PREPARE_SDCARD_GSDL3HOME/sites/localsite/collect
+fi
+
+/bin/cp -u -v $GSDL3HOME/sites/localsite/siteConfig.xml $PREPARE_SDCARD_GSDL3HOME/sites/localsite/.
+
+/bin/cp -u -v -r $GSDL3HOME/sites/localsite/etc $PREPARE_SDCARD_GSDL3HOME/sites/localsite/.
+
+/bin/cp -u -v -r $GSDL3HOME/sites/localsite/collect/lucene-jdbm-demo $PREPARE_SDCARD_GSDL3HOME/sites/localsite/collect/.
+
+if [ ! -d $PREPARE_SDCARD_GSDL3HOME/sites/localsite/collect/lucene-jdbm-demo/index ] ; then
+  pushd $PREPARE_SDCARD_GSDL3HOME/sites/localsite/collect/lucene-jdbm-demo
+  unzip index.zip
+  popd
+fi
+
+echo ""
+echo "####"
+echo "# If not already done so, run: "
+echo "#   ./PREPARE-JAVA-TO-DEX.sh"
+echo "# to cross-compile the Greenstone code and supporting JAR files"
+echo "####"
+echo ""
+
+
+
Index: 3-extensions/i-jetty/trunk/src/WEBAPP-ROOT-TO-SDCARD.sh
===================================================================
--- /gs3-extensions/i-jetty/trunk/src/WEBAPP-ROOT-TO-SDCARD.sh	(revision 25622)
+++ 	(revision )
@@ -1,74 +1,0 @@
-#!/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 "  => Have you launched i-jetty at least once to create the 'jetty' directory on the sd-card?"
-  echo "  => If all else fails, you can set the environment variable SDCARD_WEBAPPS explicitly"
-  exit -1
-fi
-
-
-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"
-echo "# (this may take several minutes)"
-echo "#---"
-echo ""
-
-if [ $mode = "Installing" ] ; then
-  (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/{}
-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/{}
-
-/bin/cp resources/index.html $SDCARD_GSDL3HOME/.
-/bin/cp resources/web.xml $SDCARD_GSDL3HOME/WEB-INF/.
-
-if [ ! -d $SDCARD_GSDL3HOME/sites/localsite ] ; then
-  echo "Creating 'localsite' in $SDCARD_GSDLHOME"
-  mkdir $SDCARD_GSDL3HOME/sites/localsite
-  mkdir $SDCARD_GSDL3HOME/sites/localsite/collect
-fi
-
-/bin/cp -u -v $GSDL3HOME/sites/localsite/siteConfig.xml $SDCARD_GSDL3HOME/sites/localsite/.
-
-/bin/cp -u -v -r $GSDL3HOME/sites/localsite/etc $SDCARD_GSDL3HOME/sites/localsite/.
-
-/bin/cp -u -v -r $GSDL3HOME/sites/localsite/collect/lucene-jdbm-demo $SDCARD_GSDL3HOME/sites/localsite/collect/.
-
-if [ ! -d $SDCARD_GSDL3HOME/sites/localsite/collect/lucene-jdbm-demo/index ] ; then
-  pushd $SDCARD_GSDL3HOME/sites/localsite/collect/lucene-jdbm-demo
-  unzip index.zip
-  popd
-fi
-
-echo ""
-echo "####"
-echo "# If not already done so, run: "
-echo "#   ./JAVA-TO-DEX.sh"
-echo "# to cross-compile the Greenstone code and supporting JAR files"
-echo "####"
-echo ""
-
-
-
Index: /gs3-extensions/i-jetty/trunk/src/setup.bash
===================================================================
--- /gs3-extensions/i-jetty/trunk/src/setup.bash	(revision 25622)
+++ /gs3-extensions/i-jetty/trunk/src/setup.bash	(revision 25623)
@@ -1,11 +1,13 @@
+
+
 
 if [ "x$ANDROID_SDK_HOME" = "x" ] ; then
   if [ ! -e setup-android.bash ] ; then
-    echo "Unable to find 'setup-android.bash'.  You either need to:"
-    echo "  1) copy setup-android.bash.in to setup-android.bash and"
-    echo "     edit **ANDROID_SDK_HOME** to point to where this is located"
-    echo "     on your file system, or"
-    echo "  2) Explicitly set the environment variable ANDROID_SDK_HOME"
-    echo "     and make sure 'dx' is on your PATH"
+    echo "Unable to find 'setup-android.bash'.  You either need to:" 1>&2
+    echo "  1) copy setup-android.bash.in to setup-android.bash and" 1>&2
+    echo "     edit **ANDROID_SDK_HOME** to point to where this is located" 1>&2
+    echo "     on your file system, or" 1>&2
+    echo "  2) Explicitly set the environment variable ANDROID_SDK_HOME" 1>&2
+    echo "     and make sure 'dx' is on your PATH" 1>&2
     exit
   else 
@@ -24,51 +26,22 @@
 fi
 
-if [ "x$SDCARD_WEBAPPS" = "x" ] ; then
+export PREPARE_SDCARD_GSDL3HOME=$IJETTY_HOME/webapps/greenstone3/
 
-  possible_drives=""
-  if [ "x$IJOS" = "xcygwin" ] ; then
+export WITHIN_SDCARD_WEBAPPS=/sdcard/jetty/webapps
+export WITHIN_SDCARD_GSDL3HOME=$WITHIN_SDCARD_WEBAPPS/greenstone3
 
-    possible_drives=`ls -d /cygdrive/*/jetty/webapps 2>/dev/null`
-  elif [ "x$IJOS" = "xmingw" ] ; then
-    possible_drives=`ls -d /*/jetty/webapps 2>/dev/null`
-  else
-    # Linux and MacOS
-    possible_drives=`ls -d /mnt/*/jetty/webapps 2>/dev/null`
-  fi
-
-  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"   
-  elif [ $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
-
-export PREPARE_SDCARD_GSDL3HOME=`pwd`/war/greenstone3/
-
-if [ "x$SDCARD_WEBAPPS" != "x" ] ; then
-  export SDCARD_GSDL3HOME=$SDCARD_WEBAPPS/greenstone3/
-  echo ""
-  echo "  Using:"
-  echo ""
-  echo "     $PREPARE_SDCARD_GSDL3HOME"
-  echo ""
-  echo "  as the *preparation* area for the Greenstone servlet"
-  echo ""
-  echo "  Using:"
-  echo ""
-  echo "     $SDCARD_GSDL3HOME"
-  echo ""
-  echo "  as the *installation* point for the Greenstone servlet"
-  echo ""
-fi
+echo ""
+echo "  Using:"
+echo ""
+echo "     $PREPARE_SDCARD_GSDL3HOME"
+echo ""
+echo "  as the webapps *preparation* area for the Greenstone servlet"
+echo ""
+echo "  Using:"
+echo ""
+echo "     $WITHIN_SDCARD_GSDL3HOME"
+echo ""
+echo "  as the *installation* point for the Greenstone servlet on the sd-card"
+echo ""
 
 
@@ -96,18 +69,19 @@
 echo "to install jetty on your device, followed by"
 echo ""
-echo "  ./WEBAPP-ROOT-TO-SDCARD.sh"
+echo "  ./PREPARE-WEBAPPS-GREENSTONE-ROOT-FOR-IJETTY.sh"
 echo ""
-echo "to set up tGreenstone's 'web' directory within the i-jetty webapps area."
+echo "to set up Greenstone3's 'web' directory for the i-jetty webapps area."
+echo ""
 echo "Then:"
 echo ""
 echo "  ./JAVA-TO-DEX.sh"
 echo ""
-echo "to cross-compile Greenstone java code to the Android DEX format."
+echo "to cross-compile Greenstone java code to the Android DEX format and add it to the webapps area."
 echo ""
 echo "Finally run:"
 echo ""
-echo "  ./DEX-TO-SDCARD.sh"
+echo "  ./IJETTY-PUSH.sh webapps/greenstone3"
 echo ""
-echo "to install the cross-compiled files on the Android device"
+echo "to install the Greenstone3's webapps folder (including cross-compiled DEX files) on the Android device"
 echo "======"
 echo ""
