Index: /main/trunk/greenstone2/bin/script/activate.pl
===================================================================
--- /main/trunk/greenstone2/bin/script/activate.pl	(revision 30523)
+++ /main/trunk/greenstone2/bin/script/activate.pl	(revision 30524)
@@ -113,5 +113,5 @@
 	
 	print STDERR "\n";
-	print STDERR "Usage: $progname [-collectdir c -builddir b -indexdir i -site s -skipactivation -removeold -keepold -verbosity v\n";
+	print STDERR "Usage: $progname [-collectdir c -builddir b -indexdir i -site s -skipactivation -removeold -keepold -incremental -verbosity v\n";
 	print STDERR "\t-library_url URL -library_name n] <[colgroup/]collection>\n";
 	print STDERR "\n";
@@ -247,18 +247,7 @@
     
     # 1. Get library URL
-    
-    # For web servers that are external to a Greenstone installation, 
-    # the user can pass in their web server's library URL.
-    # For web servers included with GS (like tomcat for GS3 and server.exe 
-    # and apache for GS2), we work out the library URL:
-    if(!$library_url) { 
-	$library_url = $gsserver->get_library_URL(); # returns undef if no server is running
-    }
-    
-    # CollectionManager's installCollection phase in GLI
-    # 2. Ping the library URL, and if it's a persistent server and running, release the collection    
-    if($library_url && !$skipactivation) { # undef if no valid server URL	
-	$gsserver->do_deactivate();	
-    }
+    # CollectionManager's installCollection phase in GLI:
+    # 2. Ping the library URL, and if it's a persistent server and running, release the collection   
+    $gsserver->do_deactivate() unless $skipactivation;    
 
     # 2b. If we're working with a solr collection, then start up the solrserver now.
@@ -386,12 +375,11 @@
 
     
-    # 4. Ping the library URL, and if it's a persistent server and running, activate the collection again	
+    # 4. Ping the library URL, and if it's a persistent server and running, activate the collection again
     
     # Check for success: if building does not exist OR is empty OR if building is index (in which case there was no move)	
     if($build_dir eq $index_dir || !&FileUtils::directoryExists($build_dir) || &FileUtils::isDirectoryEmpty($build_dir)) {
 	
-	if($library_url && !$skipactivation) { # undef if no valid server URL
-	    $gsserver->do_activate();
-	}
+	$gsserver->do_activate() unless $skipactivation;
+	
     } else { # installcollection failed		
 	#CollectionManager.Preview_Ready_Failed
Index: /main/trunk/greenstone2/perllib/servercontrol.pm
===================================================================
--- /main/trunk/greenstone2/perllib/servercontrol.pm	(revision 30523)
+++ /main/trunk/greenstone2/perllib/servercontrol.pm	(revision 30524)
@@ -50,4 +50,7 @@
   my ($qualified_collection, $site, $verbosity, $build_dir, $index_dir, $collect_dir, $library_url, $library_name) = @_;
 
+  # library_url: to be specified on the cmdline if not using a GS-included web server
+  # the GSDL_LIBRARY_URL env var is useful when running cmdline buildcol.pl in the linux package manager versions of GS3
+
   my $self = {'build_dir' => $build_dir,
               'index_dir' => $index_dir,
@@ -113,9 +116,7 @@
 sub config {
     my $self = shift(@_);
-    my ($command, $check_message_against_regex, $site, $expected_error_code, $silent) = @_;
-
-    my ($library_url);
-    $library_url = $self->{'library_url'};
-    #$site = $self->{'site'};
+    my ($command, $check_message_against_regex, $expected_error_code, $silent) = @_;
+
+    my $library_url = $self->get_library_URL(); #$self->{'library_url'};
 
 
@@ -192,9 +193,6 @@
     my $self = shift(@_);
 
-    my ($library_url, $gs_mode, $qualified_collection, $site);
-    $library_url = $self->{'library_url'};
-    $gs_mode = $self->{'gs_mode'};
-    $qualified_collection = $self->{'qualified_collection'};
-    $site = $self->{'site'};
+    my $gs_mode = $self->{'gs_mode'};
+    my $qualified_collection = $self->{'qualified_collection'};
     
     if($gs_mode eq "gs2") {
@@ -206,5 +204,5 @@
 	my $DEACTIVATE_COMMAND = "?a=s&sa=d&st=collection&sn=";
 	my $check_message_against_regex = "collection: $qualified_collection deactivated";
-	$self->config($DEACTIVATE_COMMAND.$qualified_collection, $check_message_against_regex, $site);
+	$self->config($DEACTIVATE_COMMAND.$qualified_collection, $check_message_against_regex);
     }	
 }
@@ -213,9 +211,6 @@
     my $self = shift(@_);
 
-    my ($library_url, $gs_mode, $qualified_collection, $site);
-    $library_url = $self->{'library_url'};
-    $gs_mode = $self->{'gs_mode'};
-    $qualified_collection = $self->{'qualified_collection'};
-    $site = $self->{'site'};
+    my $gs_mode = $self->{'gs_mode'};
+    my $qualified_collection = $self->{'qualified_collection'};
 
     if($gs_mode eq "gs2") {
@@ -227,5 +222,5 @@
 	my $ACTIVATE_COMMAND = "?a=s&sa=a&st=collection&sn=";
 	my $check_message_against_regex = "collection: $qualified_collection activated";
-	$self->config($ACTIVATE_COMMAND.$qualified_collection, $check_message_against_regex, $site);
+	$self->config($ACTIVATE_COMMAND.$qualified_collection, $check_message_against_regex);
     }	
 }
@@ -235,9 +230,4 @@
     my $command = shift(@_);
     my $silent = shift(@_);
-
-    my ($library_url, $gs_mode, $site);
-    $library_url = $self->{'library_url'};     
-    $gs_mode = $self->{'gs_mode'};
-    $site = $self->{'site'};
     
     # If the GS server is not running, we *expect* to see a "500" status code.
@@ -250,5 +240,5 @@
     $self->print_msg("*** COMMAND WAS: |$command|***\n", 4);
     
-    return $self->config($command, $check_responsemsg_against_regex, $site, $expected_error_code, $silent);
+    return $self->config($command, $check_responsemsg_against_regex, $expected_error_code, $silent);
 }
 
@@ -257,8 +247,5 @@
     my $self = shift(@_);
 
-    my ($library_url, $gs_mode, $site);
-    $library_url = $self->{'library_url'};
-    $gs_mode = $self->{'gs_mode'};
-    $site = $self->{'site'};
+    my $gs_mode = $self->{'gs_mode'};
 
     my $command = "";
@@ -278,10 +265,6 @@
     my $silent = shift(@_);
 
-    my ($library_url, $gs_mode, $qualified_collection, $site);
-    $library_url = $self->{'library_url'};
-    $gs_mode = $self->{'gs_mode'};
-    $qualified_collection = $self->{'qualified_collection'};
-    $site = $self->{'site'};
-    #$silent = $self->{'silent'};
+    my $gs_mode = $self->{'gs_mode'};
+    my $qualified_collection = $self->{'qualified_collection'};
 
     my $command = "";
@@ -299,10 +282,6 @@
 sub is_persistent {
     my $self = shift(@_);
-
-    my ($library_url, $gs_mode);
-    $library_url = $self->{'library_url'};
-    $gs_mode = $self->{'gs_mode'};
-    
-    if($gs_mode eq "gs3") { # GS3 server is always persistent
+    
+    if($self->{'gs_mode'} eq "gs3") { # GS3 server is always persistent
 	return 1;
     }
@@ -450,11 +429,23 @@
     my $self = shift(@_);
 
-    my($is_persistent_server, $library_url, $gs_mode, $site, $qualified_collection);
-    $is_persistent_server = $self->{'is_persistent_server'};
-    $library_url = $self->get_library_URL(); #may not yet be set, so can't do $self->{'library_url'};
-    $site = $self->{'site'};
-    $gs_mode = $self->{'gs_mode'};
-    $qualified_collection = $self->{'qualified_collection'};
-
+    # 1. Get library URL
+    
+    # For web servers that are external to a Greenstone installation, 
+    # the user can pass in their web server's library URL.
+    # For web servers included with GS (like tomcat for GS3 and server.exe 
+    # and apache for GS2), we work out the library URL:
+
+    # Can't do $self->{'library_url'}, because it may not yet be set
+    my $library_url = $self->get_library_URL(); # returns undef if no server is running
+
+    if(!defined $library_url) { # undef if no valid server URL
+	return; # can't do any deactivation without a running GS server
+    }
+
+    my $is_persistent_server = $self->{'is_persistent_server'};
+    my $qualified_collection = $self->{'qualified_collection'};
+
+    # CollectionManager's installCollection phase in GLI
+    # 2. Ping the library URL, and if it's a persistent server and running, release the collection
 
     $self->print_msg("Pinging $library_url\n");		
@@ -498,10 +489,12 @@
     my $self = shift @_;
 
-    my($is_persistent_server, $library_url, $gs_mode, $site, $qualified_collection);
-    $is_persistent_server = $self->{'is_persistent_server'};
-    $library_url = $self->get_library_URL(); #may not yet be set, so can't do $self->{'library_url'};
-    $site = $self->{'site'};
-    $gs_mode = $self->{'gs_mode'};
-    $qualified_collection = $self->{'qualified_collection'};
+    my $library_url = $self->get_library_URL(); # Can't do $self->{'library_url'}; as it may not be set yet
+
+    if(!defined $library_url) { # undef if no valid server URL
+	return; # nothing to activate if there's no running server
+    }
+
+    my $is_persistent_server = $self->{'is_persistent_server'};
+    my $qualified_collection = $self->{'qualified_collection'};
 
     $self->print_msg("Pinging $library_url\n");
