Changeset 28560 for main/trunk/greenstone2/perllib/g2futil.pm
- Timestamp:
- 2013-10-30T20:54:49+13:00 (10 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
main/trunk/greenstone2/perllib/g2futil.pm
r26440 r28560 9 9 } 10 10 11 my $fedora_client_bin = & util::filename_cat($ENV{'FEDORA_HOME'},"client","bin");11 my $fedora_client_bin = &FileUtils::filenameConcatenate($ENV{'FEDORA_HOME'},"client","bin"); 12 12 &util::envvar_append("PATH",$fedora_client_bin); 13 13 } … … 15 15 use strict; 16 16 use util; 17 use FileUtils; 17 18 18 19 sub run_cmd_old … … 186 187 #$ENV{'fgsPassword'} = $options->{'password'}; 187 188 188 #my $prog = & util::filename_cat($ENV{'FEDORA_GSEARCH'}, "runRESTClient.sh");189 my $prog = & util::filename_cat($fedoragsearch_webapp, "client", "runRESTClient.sh");189 #my $prog = &FileUtils::filenameConcatenate($ENV{'FEDORA_GSEARCH'}, "runRESTClient.sh"); 190 my $prog = &FileUtils::filenameConcatenate($fedoragsearch_webapp, "client", "runRESTClient.sh"); 190 191 191 192 my $gsearch_commands = "updateIndex deletePid"; # deletePID … … 214 215 #$ENV{'fgsPassword'} = $options->{'password'}; 215 216 216 #my $prog = & util::filename_cat($ENV{'FEDORA_GSEARCH'}, "runRESTClient.sh");217 my $prog = & util::filename_cat($fedoragsearch_webapp, "client", "runRESTClient.sh");217 #my $prog = &FileUtils::filenameConcatenate($ENV{'FEDORA_GSEARCH'}, "runRESTClient.sh"); 218 my $prog = &FileUtils::filenameConcatenate($fedoragsearch_webapp, "client", "runRESTClient.sh"); 218 219 219 220 my $gsearch_commands = "updateIndex fromPid"; # fromPID … … 231 232 # if GS3, first look for a fedoragsearch webapp installed in Greenstone's tomcat 232 233 if(defined $ENV{'GSDL3SRCHOME'}) { 233 $fedoragsearch_webapp = & util::filename_cat($ENV{'GSDL3SRCHOME'},"packages","tomcat","webapps","fedoragsearch");234 return $fedoragsearch_webapp if (& util::dir_exists($fedoragsearch_webapp));234 $fedoragsearch_webapp = &FileUtils::filenameConcatenate($ENV{'GSDL3SRCHOME'},"packages","tomcat","webapps","fedoragsearch"); 235 return $fedoragsearch_webapp if (&FileUtils::directoryExists($fedoragsearch_webapp)); 235 236 } 236 237 237 238 # next look for a fedoragsearch webapp installed in Fedora's tomcat 238 239 if(defined $ENV{'FEDORA_HOME'}) { 239 $fedoragsearch_webapp = & util::filename_cat($ENV{'FEDORA_HOME'},"tomcat","webapps","fedoragsearch");240 return $fedoragsearch_webapp if (& util::dir_exists($fedoragsearch_webapp));240 $fedoragsearch_webapp = &FileUtils::filenameConcatenate($ENV{'FEDORA_HOME'},"tomcat","webapps","fedoragsearch"); 241 return $fedoragsearch_webapp if (&FileUtils::directoryExists($fedoragsearch_webapp)); 241 242 } 242 243 … … 287 288 288 289 if (opendir(DIR, $full_dir)) { 289 my @sub_dirs = grep { ($_ !~ /^\./) && (-d & util::filename_cat($full_dir,$_)) } readdir(DIR);290 my @sub_dirs = grep { ($_ !~ /^\./) && (-d &FileUtils::filenameConcatenate($full_dir,$_)) } readdir(DIR); 290 291 closedir DIR; 291 292 … … 294 295 295 296 foreach my $hd (@hash_dirs) { 296 my $full_hash_dir = & util::filename_cat($full_dir,$hd);297 my $full_hash_dir = &FileUtils::filenameConcatenate($full_dir,$hd); 297 298 push(@$all_dirs,$full_hash_dir); 298 299 } 299 300 300 301 foreach my $rd (@rec_dirs) { 301 my $full_rec_dir = & util::filename_cat($full_dir,$rd);302 my $full_rec_dir = &FileUtils::filenameConcatenate($full_dir,$rd); 302 303 rec_get_all_hash_dirs($full_rec_dir,$all_dirs); 303 304 } … … 329 330 my $hash_id = undef; 330 331 331 my $docmets_filename = & util::filename_cat($hash_dir,"docmets.xml");332 my $docmets_filename = &FileUtils::filenameConcatenate($hash_dir,"docmets.xml"); 332 333 333 334 if (open(DIN,"<$docmets_filename")) … … 372 373 # to temporarily set CATALINA_HOME to fedora's tomcat. (Catalina is undefined for GS2.) 373 374 my $gs_catalina_home = $ENV{'CATALINA_HOME'} if defined $ENV{'CATALINA_HOME'}; 374 $ENV{'CATALINA_HOME'} = & util::filename_cat($ENV{'FEDORA_HOME'}, "tomcat");375 $ENV{'CATALINA_HOME'} = &FileUtils::filenameConcatenate($ENV{'FEDORA_HOME'}, "tomcat"); 375 376 376 377 # 1. Find out which folder to write to: fedora_host or localhost 377 378 # whichever contains fedora.xml is the one we want (if none, exit with error value?) 378 379 my $fedora_home = $ENV{'FEDORA_HOME'}; 379 my $base_path = & util::filename_cat($fedora_home, "tomcat", "conf", "Catalina");380 381 my $host_path = & util::filename_cat($base_path, $fedora_host);382 my $xmlFile = & util::filename_cat($host_path, "fedora.xml");380 my $base_path = &FileUtils::filenameConcatenate($fedora_home, "tomcat", "conf", "Catalina"); 381 382 my $host_path = &FileUtils::filenameConcatenate($base_path, $fedora_host); 383 my $xmlFile = &FileUtils::filenameConcatenate($host_path, "fedora.xml"); 383 384 if (!-e $xmlFile) { 384 385 # check if the folder localhost contains fedoraXML 385 $host_path = & util::filename_cat($base_path, "localhost");386 $xmlFile = & util::filename_cat($host_path, "fedora.xml");386 $host_path = &FileUtils::filenameConcatenate($base_path, "localhost"); 387 $xmlFile = &FileUtils::filenameConcatenate($host_path, "fedora.xml"); 387 388 if(!-e $xmlFile) { 388 389 # try putting gsdl in this folder, but still print a warning … … 405 406 # 3. If there is already a gsdl.xml file in host_path, compare the string we 406 407 # want to write with what is already in there. If they're the same, we can return 407 $xmlFile = & util::filename_cat($host_path, "gsdl.xml");408 $xmlFile = &FileUtils::filenameConcatenate($host_path, "gsdl.xml"); 408 409 if(-e $xmlFile) { 409 410 # such a file exists, so read the contents … … 428 429 # a. First stop the fedora server 429 430 my $script_ext = ($ENV{'GSDLOS'} =~ m/^windows/) ? ".bat" : ".sh"; 430 my $stop_tomcat = & util::filename_cat($fedora_home, "tomcat", "bin", "shutdown".$script_ext);431 my $stop_tomcat = &FileUtils::filenameConcatenate($fedora_home, "tomcat", "bin", "shutdown".$script_ext); 431 432 # execute the command 432 433 $! = 0; # does this initialise the return value? … … 447 448 448 449 # c. Restart the fedora server 449 my $start_tomcat = & util::filename_cat($fedora_home, "tomcat", "bin", "startup".$script_ext);450 my $start_tomcat = &FileUtils::filenameConcatenate($fedora_home, "tomcat", "bin", "startup".$script_ext); 450 451 $! = 0; 451 452 $status = system($start_tomcat); … … 458 459 $ENV{'CATALINA_HOME'} = $gs_catalina_home if defined $gs_catalina_home; 459 460 461 # the wget binary is dependent on the gnomelib_env (particularly lib/libiconv2.dylib) being set, particularly on Mac Lions (android too?) 462 &util::set_gnomelib_env(); # this will set the gnomelib env once for each subshell launched, by first checking if GEXTGNOME is not already set 463 460 464 # Starting up the Fedora server takes a long time. We need to wait for the server to be 461 465 # ready before import can continue, because g2f-import relies on an up-and-running Fedora
Note:
See TracChangeset
for help on using the changeset viewer.