Changeset 21733


Ignore:
Timestamp:
2010-02-24T13:56:56+13:00 (14 years ago)
Author:
kjdon
Message:

a little tidying up and code reuse and making these work for gs3 with -site arg

Location:
main/trunk/greenstone2/bin/script
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • main/trunk/greenstone2/bin/script/incremental-buildcol.pl

    r20925 r21733  
    6161
    6262
    63     my $collect = pop @argv;
     63    my $collection = pop @argv;
    6464
    6565    my @filtered_argv = ();
     
    8787    }
    8888
    89 
    90     if (!defined $collect_dir) {
    91     $collect_dir = &util::filename_cat($ENV{'GSDLHOME'},"collect");
    92     }
    93     my $this_collect_dir = &util::filename_cat($collect_dir,$collect);
    94 
    95     if (!-d $this_collect_dir) {
    96     print STDERR "Error: $collect_dir does not exist\n";
    97     exit(-1);
    98     }
     89    # get and check the collection name
     90    if ((&colcfg::use_collection($site, $collection, $collect_dir)) eq "") {
     91    print STDERR "Unable to use collection \"$collection\" within \"$collect_dir\"\n";
     92    exit -1;
     93    }   
    9994
    10095
    10196    if (!defined $build_dir) {
    10297    # Yes this is intentional that 'build_dir' points to "index"
    103     $build_dir = &util::filename_cat($this_collect_dir,"index");
     98    $build_dir = &util::filename_cat ($ENV{'GSDLCOLLECTDIR'},"index");
    10499    push(@filtered_argv,"-builddir",$build_dir);
    105100    }
     
    119114    }
    120115
    121     if ((&colcfg::use_collection($site, $collect, $collect_dir)) eq "") {
    122     print STDERR "Unable to use collection \"$collect\" within \"$collect_dir\"\n";
    123     exit -1;
    124     }
    125116    # Read in the collection configuration file.
    126117    my ($collect_cfg_filename, $gs_mode) = &colcfg::get_collect_cfg_name(STDERR);
     
    163154
    164155   
    165     $buildcol_cmd .= " $quoted_argv \"$collect\"";
     156    $buildcol_cmd .= " $quoted_argv \"$collection\"";
    166157   
    167158    my $buildcol_status = system($buildcol_cmd)/256;
  • main/trunk/greenstone2/bin/script/incremental-import.pl

    r21732 r21733  
    4343use dbutil;
    4444use util;
    45 
     45use colcfg;
    4646
    4747sub main
     
    6161
    6262
    63     my $collect = pop @argv;
     63    my $collection = pop @argv;
    6464
    6565    my @filtered_argv = ();
     
    6767    my $collect_dir = undef;
    6868    my $archive_dir  = undef;
     69    my $site = undef;
    6970
    7071    while (my $arg = shift @argv) {
     
    8182        push(@filtered_argv,$arg,$archive_dir);
    8283    }
     84    elsif ($arg eq "-site") {
     85        $site = shift @argv;
     86        push(@filtered_argv,$arg,$site);
     87    }
    8388    else {
    8489        push(@filtered_argv,$arg);
    8590    }
    8691    }
    87 
    88     if (!defined $collect_dir) {
    89     $collect_dir = &util::filename_cat($ENV{'GSDLHOME'},"collect");
    90     }
    91     my $this_collect_dir = &util::filename_cat($collect_dir,$collect);
    92 
    93     if (!-d $this_collect_dir) {
    94     print STDERR "Error: $this_collect_dir does not exist\n";
    95     exit(-1);
    96     }
    97 
     92   
     93    # get and check the collection name
     94    if ((&colcfg::use_collection($site, $collection, $collect_dir)) eq "") {
     95    print STDERR "Unable to use collection \"$collection\" within \"$collect_dir\"\n";
     96    exit -1;
     97    }   
    9898
    9999    if (!defined $archive_dir) {
    100     $archive_dir = &util::filename_cat($this_collect_dir,"archives");
     100    $archive_dir = &util::filename_cat ($ENV{'GSDLCOLLECTDIR'}, "archives")
    101101    }
    102102
     
    132132    }
    133133
    134     $import_cmd .= " $quoted_argv \"$collect\"";
     134    $import_cmd .= " $quoted_argv \"$collection\"";
    135135
    136136   
Note: See TracChangeset for help on using the changeset viewer.