Ignore:
Timestamp:
2008-05-20T18:44:14+12:00 (16 years ago)
Author:
ak19
Message:

Corrected some discrepancies so that it now works on Windows: the setting of ENV(PATH) at the top and edits to write_gsdl_xml_file

File:
1 edited

Legend:

Unmodified
Added
Removed
  • gsdl/trunk/perllib/g2futil.pm

    r15582 r15605  
    55{
    66    if (!defined $ENV{'FEDORA_HOME'}) {
    7     print STDERR "ERROR: Environment variable FEDORA_HOME not set.\n";
     7    print STDERR "Error: Environment variable FEDORA_HOME not set.\n";
    88    exit 1;
    99    }
     
    1111    my $fedora_home = $ENV{'FEDORA_HOME'};
    1212    my $fedora_client_bin = &util::filename_cat($fedora_home,"client","bin");
    13     $ENV{'PATH'} .= ":$fedora_client_bin";
     13    if($ENV{'GSDLOS'} =~ m/^windows/) {
     14    $ENV{'PATH'} .= ";$fedora_client_bin";
     15    } else {
     16    $ENV{'PATH'} .= ":$fedora_client_bin";
     17    }
    1418}
    1519
     
    6064    }
    6165 
    62 
    6366    my $cmd = "$prog $arguments";
    6467
    65 ###    print "*** cmd = $cmd\n";
     68    print "*** cmd = $cmd\n";
    6669
    6770    if (open(CMD,"$cmd 2>&1 |"))
     
    237240sub write_gsdl_xml_file
    238241{
    239     my ($fedora_host, $collect_dir) = @_;
    240    
     242    my ($fedora_host, $collect_dir, $options) = @_;
     243    my $verbosity = $options->{'verbosity'};
     244
    241245    print STDERR "Ensuring that a correct gsdl.xml file exists on the Fedora server end\n";
    242246    # The top of this file has already made sure that FEDORA_HOME is set
     
    264268    my $collectParentDir = $collect_dir;
    265269    $collectParentDir =~ s/collect(\/|\\)?//;
     270   
     271    #replace \ in path as occurs on Windows with /?
     272    #$collectParentDir =~ s/\\/\//g;
    266273    #print STDERR "**** collect's parent dir is: $collectParentDir\n";
    267274
     
    294301    # 4. If we're here, the contents of gsdl.xml need to be updated:
    295302    # a. First stop the fedora server
    296     my $stop_tomcat = &util::filename_cat($fedora_home, "tomcat", "bin", "shutdown.sh");
     303    my $script_ext = ($ENV{'GSDLOS'} =~ m/^windows/) ? ".bat" : ".sh";
     304    my $stop_tomcat = &util::filename_cat($fedora_home, "tomcat", "bin", "shutdown".$script_ext);
    297305    # execute the command
    298306    $!=0; # does this initialise the return value?
    299     if (system($stop_tomcat)!=0) { # to get the actual exit value, divide by 256, but not useful here
     307    my $status = system($stop_tomcat);
     308    if ($status!=0) { # to get the actual exit value, divide by 256, but not useful here
    300309    # possible tomcat was already stopped - it's not the end of the world
    301310    print STDERR "**** Failed to stop Fedora server. Perhaps it was not running. $!\n";
     311    print "Exit status = ", $status/256, "\n";
    302312    }
    303313
     
    311321
    312322    # c. Restart the fedora server
    313     my $start_tomcat = &util::filename_cat($fedora_home, "tomcat", "bin", "startup.sh");
     323    my $start_tomcat = &util::filename_cat($fedora_home, "tomcat", "bin", "startup".$script_ext);
    314324    $!=0;
    315     if (system($start_tomcat)!=0) {
     325    $status = system($start_tomcat);
     326    if ($status!=0) {
    316327    print STDERR "Failed to restart the Fedora server... ERROR: $!\n";
    317     }
     328    print "Exit status = ", $status/256, "\n";
     329    }
     330   
     331   
    318332    # QUESTION:
    319333    # Starting up the Fedora server takes a long time. How long should we wait before
Note: See TracChangeset for help on using the changeset viewer.