Changeset 29983


Ignore:
Timestamp:
06/16/15 19:48:57 (6 years ago)
Author:
ak19
Message:

Incorporated Kathy's useful suggestion to have a separate library_name parameter to activate.pl so that collections in a different servlet can be activated. This could be done with the existing library_url parameter too by passing -activate:library_url <URL> to buildcol.pl, but if the servlet name is all that is different from the default URL it will save in typing.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • main/trunk/greenstone2/bin/script/activate.pl

    r29948 r29983  
    302302   
    303303sub get_library_URL {
    304     my $gs_mode = shift(@_); # gs3 or gs2
     304    my ($gs_mode, $lib_name) = @_; # gs_mode can be gs3 or gs2, lib_name is the custom servlet name
    305305   
    306306    # If we get here, we are dealing with a server included with GS.
     
    401401        } else {
    402402            &print_msg("activate.pl::get_library_URL: Failed to run $perl_command to work out library URL for $gs_mode\n");
    403         }       
     403        }
     404        if(defined $lib_name) {
     405            # replace the servlet_name portion of the url found, with the given library_name
     406            $url =~ s@/[^/]*$@/$lib_name@;
     407        }
    404408    }
    405409   
     
    479483        print STDERR "\n";
    480484        print STDERR "Usage: $progname [-collectdir c -builddir b -indexdir i -site s -skipactivation -removeold -keepold -verbosity v\n";
    481         print STDERR "\t-library_url URL] <[colgroup/]collection>\n";
     485        print STDERR "\t-library_url URL -library_name n] <[colgroup/]collection>\n";
    482486        print STDERR "\n";
    483487
     
    502506        # the GSDL_LIBRARY_URL env var is useful when running cmdline buildcol.pl in the linux package manager versions of GS3
    503507   
     508    my $library_name = undef;
     509
    504510    while (my $arg = shift @argv) {
    505511        if ($arg eq "-collectdir") {
     
    529535        elsif ($arg eq "-library_url") {
    530536            $library_url = shift @argv;
     537        }
     538        elsif ($arg eq "-library_name") {
     539            $library_name = shift @argv;
    531540        }
    532541        elsif ($arg eq "-verbosity") {
     
    608617    # and apache for GS2), we work out the library URL:
    609618    if(!$library_url) {
    610         $library_url = &get_library_URL($gs_mode); # returns undef if no server is running
     619        $library_url = &get_library_URL($gs_mode, $library_name); # returns undef if no server is running
    611620    }
    612621   
Note: See TracChangeset for help on using the changeset viewer.