Index: /gs3-extensions/mat/trunk/bin/script/mat-colbuild-download.bash
===================================================================
--- /gs3-extensions/mat/trunk/bin/script/mat-colbuild-download.bash	(revision 22040)
+++ /gs3-extensions/mat/trunk/bin/script/mat-colbuild-download.bash	(revision 22041)
@@ -13,8 +13,16 @@
 # $9 should be the creator
 # $10 should be the proxy settings
+
+COL_NAME=$1
+OAI_URL=$2
+CACHE_DIR=$3
+MAX_RECORDS=$4
+OAI_PREF=$5
 GS3_ROOT=$6
 COLLECT_DIR=$7
 LOG_FILE=$8
-CACHE_DIR=$3
+CREATOR=$9
+#SHIFT
+#PROXY=$9
 
 if [ -x /usr/bin/lsof ] ; then
@@ -28,5 +36,5 @@
 fi
 
-TOMCAT_ID=`ps ux  | grep tomcat | grep java | grep -v grep | awk -F" " '{ print $2 }'`
+TOMCAT_ID=`ps ux  | grep tomcat | grep java | grep -v grep | awk -F" " '{ print $OAI_URL }'`
 
 if [ ! -z "$lsof" ] ; then
@@ -44,7 +52,7 @@
 source setup.bash >> $LOG_FILE
 
-perl -S mkcol.pl -gs3mode -collectdir $COLLECT_DIR $1
+perl -S mkcol.pl -gs3mode -buildtype lucene -collectdir $COLLECT_DIR $COL_NAME
 
-echo $1 $2 $3 $4 $5 $6 $7 $8 >> $LOG_FILE
+echo $COL_NAME $OAI_URL $CACHE_DIR $MAX_RECORDS $OAI_PREF $GS3_ROOT $COLLECT_DIR $LOG_FILE >> $LOG_FILE
 
 if [ ! -z "$lsof" ] ; then
@@ -67,5 +75,5 @@
 fi
 
-perl -S downloadfrom.pl -download_mode OAI -cache_dir $CACHE_DIR -url $2 -max_records $4 -metadata_prefix $5 $9  2>&1 >> $LOG_FILE
+perl -S downloadfrom.pl -download_mode OAI -cache_dir $CACHE_DIR -url $OAI_URL -max_records $MAX_RECORDS -metadata_prefix $OAI_PREF $CREATOR 2>&1 >> $LOG_FILE
 
 if [ ! -z "$lsof" ] ; then
Index: /gs3-extensions/mat/trunk/bin/script/mat-colbuild.bash
===================================================================
--- /gs3-extensions/mat/trunk/bin/script/mat-colbuild.bash	(revision 22040)
+++ /gs3-extensions/mat/trunk/bin/script/mat-colbuild.bash	(revision 22041)
@@ -5,15 +5,16 @@
 # $2 should be the oai URL
 # $3 should the cache directory
-# $4 should be the max records
-# $5 should be the OAI metadata prefix
-# $6 should be GS3 root
-# $7 should be the collection directory
-# $8 should the log file
-# $9 should be the host name : port number
+# $4 should be GS3 root
+# $5 should be the collection directory
+# $6 should the log file
+# $7 should be the host name : port number
 
-#$GS3_ROOT=$6
-#$COLLECT_DIR=$7
-#$LOG_FILE=$8
+COL_NAME=$1
+OAI_URL=$2
 CACHE_DIR=$3
+GS3_ROOT=$4
+COL_DIR=$5
+LOG_FILE=$6
+HOST_PORT=$7
 
 # check we are still in the right directories
@@ -29,5 +30,5 @@
 fi
 
-TOMCAT_ID=`ps ux  | grep tomcat | grep java | grep -v grep | awk -F" " '{ print $2 }'`
+TOMCAT_ID=`ps ux  | grep tomcat | grep java | grep -v grep | awk -F" " '{ print $OAI_URL }'`
 echo Tomcat_ID: $TOMCAT_ID
 
@@ -37,10 +38,9 @@
 fi
 
-cd $6
-source gs3-setup.sh >> $8
+cd $GS3_ROOT
+source gs3-setup.sh >> $LOG_FILE
 
 cd gs2build/
-source setup.bash >> $8
-
+source setup.bash >> $LOG_FILE
 
 # event log goes to greenstone3/gs2build/etc/events.txt
@@ -48,7 +48,14 @@
 ## build -indextype lucene -site localsite -collectdir $COLLECT_DIR -download file://$3 -log_events $1
 
-echo "Away to build"  >> $8
+echo "Away to build"  >> $LOG_FILE
+#echo "BABAB CACHE_DIR = Q $CACHE_DIR Q - COL_DIR = Q $COL_DIR Q - COL_NAME = Q $COL_NAME Q"
+#echo "AAAAA /bin/cp -r" $CACHE_DIR/* "$COL_DIR/$COL_NAME/import/."
+/bin/cp -r $CACHE_DIR/* $COL_DIR/$COL_NAME/import/.
 
-build -indextype lucene -site localsite -collectdir $7 -log_events -download file://$CACHE_DIR  $1 2>&1
+echo "perl -S incremental-rebuild.pl -site localsite -collectdir $COL_DIR $COL_NAME"
+
+perl -S incremental-rebuild.pl -site localsite -collectdir $COL_DIR $COL_NAME
+
+#build -indextype lucene -site localsite -collectdir $COL_DIR -log_events -download file://$CACHE_DIR  $COL_NAME 2>&1
 #2>&1  >> $LOG_FILE
 
@@ -57,20 +64,16 @@
 if [ ! -z "$lsof" ] ; then
   NUM_OPEN_FILES=`$lsof -p $TOMCAT_ID | wc -l `
-  echo open files: $NUM_OPEN_FILES
+  echo Finished Build: open files: $NUM_OPEN_FILES
 fi
 
-echo "Build finished ...." >> $8
+echo "Build finished ...." >> $LOG_FILE
 
-if [ -d $6/gs2build/collect/$1 ]
+if [ -d $GS3_ROOT/gs2build/collect/$COL_NAME ]
 then
-	echo "moving from gs2 dir" >> $8
+	echo "moving from gs2 dir" >> $LOG_FILE
 	echo built in gs2 dir ... moving
-	mv $6/gs2build/collect/$1 $7/$1
+	mv $GS3_ROOT/gs2build/collect/$COL_NAME $COL_DIR/$COL_NAME
 fi
 
-echo "Away to convert from Greenstone 2 to Greenstone 3"  >> $8
-echo "Away to convert from Greenstone 2 to Greenstone 3" 
-
-# >> $LOG_FILE
 
 if [ ! -z "$lsof" ] ; then
@@ -80,5 +83,5 @@
 fi
 
-echo "Away to reconfigure Greenstone 3 server"  >> $8
+echo "Away to reconfigure Greenstone 3 server"  >> $LOG_FILE
 echo "Away to reconfigure Greenstone 3 server" 
 
@@ -86,7 +89,7 @@
 
 #wget -O /tmp/mat5.html "http://localhost:8090/greenstone3/library?a=s&sa=c" 
-wget -O /tmp/mat3.html "http://$9/greenstone3/library?a=s&sa=c" 
+wget -O /tmp/mat3.html "http://$HOST_PORT/greenstone3/library?a=s&sa=c" 
 
-echo "Done"  >> $8
+echo "Done"  >> $LOG_FILE
 echo "Done" 
 
Index: /gs3-extensions/mat/trunk/src/org/greenstone/mat/servlet/MatServlet.java
===================================================================
--- /gs3-extensions/mat/trunk/src/org/greenstone/mat/servlet/MatServlet.java	(revision 22040)
+++ /gs3-extensions/mat/trunk/src/org/greenstone/mat/servlet/MatServlet.java	(revision 22041)
@@ -461,5 +461,5 @@
 	
 		
-		String[] arrays = new String[14];
+		String[] arrays = new String[11];
 		arrays[0] = "cmd";
 		arrays[1] = "/c";
@@ -468,12 +468,9 @@
 		arrays[4] = "mat-colbuild.bat";
 		arrays[5] = collName;
-		arrays[6] = oaiURLString;
-		arrays[7] = cacheDir;
-		arrays[8] = "100";
-		arrays[9] = oaiPrefix;
-		arrays[10] = gs3Root;
-		arrays[11] = collectDir;
-		arrays[12] = logFile;
-		arrays[13] = hostName + port_number;
+		arrays[6] = cacheDir;
+		arrays[7] = gs3Root;
+		arrays[8] = collectDir;
+		arrays[9] = logFile;
+		arrays[10] = hostName + ":" + port_number;
 		
 		Process p2 = processBatch(arrays,out,wd);
@@ -623,8 +620,4 @@
 	    + cacheDir
 	    + " "
-	    + maxRecords
-	    + " "
-	    + metadataprefix
-	    + " " 
 	    + gs3Root
 	    + " "
