[2075] | 1 | #!/usr/bin/perl -w
|
---|
| 2 |
|
---|
| 3 | ###########################################################################
|
---|
| 4 | #
|
---|
| 5 | # exportcol.pl --
|
---|
| 6 | # A component of the Greenstone digital library software
|
---|
| 7 | # from the New Zealand Digital Library Project at the
|
---|
| 8 | # University of Waikato, New Zealand.
|
---|
| 9 | #
|
---|
| 10 | # Copyright (C) 1999 New Zealand Digital Library Project
|
---|
| 11 | #
|
---|
| 12 | # This program is free software; you can redistribute it and/or modify
|
---|
| 13 | # it under the terms of the GNU General Public License as published by
|
---|
| 14 | # the Free Software Foundation; either version 2 of the License, or
|
---|
| 15 | # (at your option) any later version.
|
---|
| 16 | #
|
---|
| 17 | # This program is distributed in the hope that it will be useful,
|
---|
| 18 | # but WITHOUT ANY WARRANTY; without even the implied warranty of
|
---|
| 19 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
---|
| 20 | # GNU General Public License for more details.
|
---|
| 21 | #
|
---|
| 22 | # You should have received a copy of the GNU General Public License
|
---|
| 23 | # along with this program; if not, write to the Free Software
|
---|
| 24 | # Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
|
---|
| 25 | #
|
---|
| 26 | ###########################################################################
|
---|
| 27 |
|
---|
| 28 | BEGIN {
|
---|
| 29 | die "GSDLHOME not set\n" unless defined $ENV{'GSDLHOME'};
|
---|
| 30 | unshift (@INC, "$ENV{'GSDLHOME'}/perllib");
|
---|
| 31 | }
|
---|
| 32 |
|
---|
[10339] | 33 | use strict;
|
---|
| 34 | no strict 'refs'; # allow filehandles to be variables and vice versa
|
---|
| 35 | no strict 'subs'; # allow barewords (eg STDERR) as function arguments
|
---|
| 36 |
|
---|
[2075] | 37 | use util;
|
---|
[10339] | 38 | use parse2;
|
---|
[6054] | 39 | use printusage;
|
---|
[2075] | 40 |
|
---|
[6054] | 41 | my $arguments =
|
---|
[6921] | 42 | [ { 'name' => "language",
|
---|
| 43 | 'desc' => "{scripts.language}",
|
---|
| 44 | 'type' => "string",
|
---|
| 45 | 'reqd' => "no" },
|
---|
| 46 | { 'name' => "out",
|
---|
[6054] | 47 | 'desc' => "{exportcol.out}",
|
---|
| 48 | 'type' => "string",
|
---|
| 49 | 'deft' => "STDERR",
|
---|
| 50 | 'reqd' => "no" },
|
---|
[9236] | 51 | { 'name' => "nonetscape",
|
---|
| 52 | 'desc' => "{exportcol.nonetscape}",
|
---|
| 53 | 'type' => "flag",
|
---|
| 54 | 'reqd' => "no" },
|
---|
[6054] | 55 | { 'name' => "cdname",
|
---|
| 56 | 'desc' => "{exportcol.cdname}",
|
---|
| 57 | 'type' => "string",
|
---|
| 58 | 'deft' => "Greenstone Collections",
|
---|
[10225] | 59 | 'reqd' => "no" },
|
---|
| 60 | { 'name' => "cddir",
|
---|
| 61 | 'desc' => "{exportcol.cddir}",
|
---|
| 62 | 'type' => "string",
|
---|
| 63 | 'deft' => "exported_collections",
|
---|
[10339] | 64 | 'reqd' => "no" },
|
---|
| 65 | { 'name' => "xml",
|
---|
| 66 | 'desc' => "{scripts.xml}",
|
---|
| 67 | 'type' => "flag",
|
---|
| 68 | 'reqd' => "no",
|
---|
| 69 | 'hiddengli' => "yes" },
|
---|
| 70 | { 'name' => "gli",
|
---|
| 71 | 'desc' => "",
|
---|
| 72 | 'type' => "flag",
|
---|
| 73 | 'reqd' => "no",
|
---|
| 74 | 'hiddengli' => "yes" },
|
---|
[6054] | 75 |
|
---|
[10339] | 76 | ];
|
---|
| 77 |
|
---|
[6054] | 78 | my $options = { 'name' => "exportcol.pl",
|
---|
| 79 | 'desc' => "{exportcol.desc}",
|
---|
| 80 | 'args' => $arguments };
|
---|
| 81 |
|
---|
| 82 | sub gsprintf
|
---|
| 83 | {
|
---|
| 84 | return &gsprintf::gsprintf(@_);
|
---|
| 85 | }
|
---|
| 86 |
|
---|
[6921] | 87 |
|
---|
[2075] | 88 | &main();
|
---|
| 89 |
|
---|
| 90 | sub main {
|
---|
[10339] | 91 | my ($language, $out, $cdname, $cddir, $gli);
|
---|
[6054] | 92 |
|
---|
| 93 | my $xml = 0;
|
---|
[10339] | 94 | my $nonetscape = 0;
|
---|
[6921] | 95 |
|
---|
[10339] | 96 | my $hashParsingResult = {};
|
---|
| 97 | my $blnParseFailed = "false";
|
---|
| 98 | # parse options
|
---|
| 99 | my $intArgLeftinAfterParsing = parse2::parse(\@ARGV,$arguments,$hashParsingResult,"allow_extra_options");
|
---|
| 100 | # don't care how many args are left - can have multiple collection names
|
---|
| 101 | foreach my $strVariable (keys %$hashParsingResult)
|
---|
| 102 | {
|
---|
| 103 | eval "\$$strVariable = \$hashParsingResult->{\"\$strVariable\"}";
|
---|
[2075] | 104 | }
|
---|
[10339] | 105 |
|
---|
| 106 | # If $language has been specified, load the appropriate resource bundle
|
---|
| 107 | # (Otherwise, the default resource bundle will be loaded automatically)
|
---|
| 108 | if ($language && $language =~ /\S/) {
|
---|
| 109 | &gsprintf::load_language_specific_resource_bundle($language);
|
---|
| 110 | }
|
---|
| 111 |
|
---|
| 112 | if ($xml) {
|
---|
| 113 | &PrintUsage::print_xml_usage($options);
|
---|
| 114 | print "\n";
|
---|
| 115 | return;
|
---|
| 116 | }
|
---|
| 117 |
|
---|
| 118 | if ($gli) { # the gli wants strings to be in UTF-8
|
---|
| 119 | &gsprintf::output_strings_in_UTF8;
|
---|
| 120 | }
|
---|
| 121 |
|
---|
| 122 | my $use_netscape = ($nonetscape) ? 0 : 1;
|
---|
[6054] | 123 |
|
---|
[6945] | 124 | # If $language has been specified, load the appropriate resource bundle
|
---|
| 125 | # (Otherwise, the default resource bundle will be loaded automatically)
|
---|
| 126 | if ($language) {
|
---|
| 127 | &gsprintf::load_language_specific_resource_bundle($language);
|
---|
| 128 | }
|
---|
[6926] | 129 |
|
---|
[6054] | 130 | if ($xml) {
|
---|
[6926] | 131 | &PrintUsage::print_xml_usage($options);
|
---|
[6054] | 132 | die "\n";
|
---|
| 133 | }
|
---|
[6921] | 134 |
|
---|
[7101] | 135 | if ($gli) { # the gli wants strings to be in UTF-8
|
---|
| 136 | &gsprintf::output_strings_in_UTF8;
|
---|
| 137 | }
|
---|
[2075] | 138 |
|
---|
[5920] | 139 | my @coll_list = @ARGV;
|
---|
[10339] | 140 |
|
---|
[5920] | 141 | if (not @coll_list) { # empty list
|
---|
[6926] | 142 | &PrintUsage::print_txt_usage($options, "{exportcol.params}");
|
---|
[5920] | 143 | exit(1);
|
---|
[2075] | 144 | }
|
---|
[6921] | 145 |
|
---|
[2075] | 146 | my $close_out = 0;
|
---|
| 147 | if ($out !~ /^(STDERR|STDOUT)$/i) {
|
---|
[6054] | 148 | open (OUT, ">$out") ||
|
---|
[6921] | 149 | (&gsprintf(STDERR, "{common.cannot_open_output_file}\n", $out) && die);
|
---|
[7256] | 150 | $out = 'main::OUT';
|
---|
[2075] | 151 | $close_out = 1;
|
---|
| 152 | }
|
---|
| 153 |
|
---|
[7179] | 154 | # first we do a quick check to see if the export coll function has been
|
---|
| 155 | # installed
|
---|
| 156 | my $gssetupexe = &util::filename_cat ($ENV{'GSDLHOME'}, "bin", "windows", "gssetup.exe");
|
---|
| 157 | if (!-e $gssetupexe) {
|
---|
| 158 | &gsprintf($out, "{exportcol.fail} {exportcol.export_coll_not_installed}\n");
|
---|
| 159 | die "\n";
|
---|
| 160 | }
|
---|
| 161 |
|
---|
[11178] | 162 | # if we want to use netscape, check that the lanugage pack has been installed. What's best to check? for now, use one of the english image files
|
---|
| 163 | if ($use_netscape) {
|
---|
| 164 | my $search_image = &util::filename_cat ($ENV{'GSDLHOME'}, "images", "en", "tsrchgr.gif");
|
---|
| 165 | if (!-e $search_image) {
|
---|
| 166 | &gsprintf($out, "{exportcol.fail} {exportcol.lang_pack_not_installed}\n");
|
---|
| 167 | die "\n";
|
---|
| 168 | }
|
---|
| 169 | }
|
---|
| 170 |
|
---|
[5920] | 171 | # check each collection
|
---|
| 172 | my @valid_coll_list = ();
|
---|
[10339] | 173 | foreach my $c (@coll_list) {
|
---|
[5920] | 174 | my $colldir = &util::filename_cat ($ENV{'GSDLHOME'}, "collect", $c);
|
---|
| 175 | if (! -d $colldir) {
|
---|
[6054] | 176 | &gsprintf($out, "{exportcol.coll_not_found}\n", $c, $colldir);
|
---|
[5920] | 177 | next;
|
---|
| 178 | }
|
---|
| 179 | my $colindexdir = &util::filename_cat ($colldir, "index");
|
---|
| 180 | my $coletcdir = &util::filename_cat ($colldir, "etc");
|
---|
| 181 | if ((!-d $colindexdir) || (!-d $coletcdir)) {
|
---|
[6054] | 182 | &gsprintf($out, "{exportcol.coll_dirs_not_found}\n", $c);
|
---|
[6921] | 183 | &gsprintf($out, " $colindexdir\n");
|
---|
| 184 | &gsprintf($out, " $coletcdir\n");
|
---|
[5920] | 185 | next;
|
---|
| 186 | }
|
---|
| 187 | # the collection seems ok, we add it to the valid coll list
|
---|
| 188 | push @valid_coll_list, $c;
|
---|
| 189 | }
|
---|
| 190 |
|
---|
| 191 | if (not @valid_coll_list) {
|
---|
| 192 | # no valid colls left
|
---|
[6921] | 193 | &gsprintf($out, "{exportcol.fail} {exportcol.no_valid_colls}\n");
|
---|
[5837] | 194 | die "\n";
|
---|
[2138] | 195 | }
|
---|
| 196 |
|
---|
[2075] | 197 | # create exported directory
|
---|
[10225] | 198 | my $topdir = &util::filename_cat ($ENV{'GSDLHOME'}, "tmp", $cddir);
|
---|
[2075] | 199 | &util::mk_all_dir ($topdir);
|
---|
| 200 | if (!-d $topdir) {
|
---|
[6921] | 201 | &gsprintf($out, "{exportcol.fail} {exportcol.couldnt_create_dir}\n", $topdir);
|
---|
[2075] | 202 | die "\n";
|
---|
| 203 | }
|
---|
| 204 |
|
---|
| 205 | # make other directories (we'll assume that if we created topdir
|
---|
| 206 | # successfully there'll be no problems creating these)
|
---|
| 207 | my $gsdldir = &util::filename_cat ($topdir, "gsdl");
|
---|
| 208 | &util::mk_all_dir ($gsdldir);
|
---|
| 209 | my $collectdir = &util::filename_cat ($gsdldir, "collect");
|
---|
| 210 | &util::mk_all_dir ($collectdir);
|
---|
| 211 | my $etcdir = &util::filename_cat ($gsdldir, "etc");
|
---|
| 212 | &util::mk_all_dir ($etcdir);
|
---|
[3730] | 213 | my $binjavadir = &util::filename_cat ($gsdldir, "bin", "java");
|
---|
| 214 | &util::mk_all_dir ($binjavadir);
|
---|
[2075] | 215 |
|
---|
| 216 | # create the install.cfg file
|
---|
| 217 | my $installcfg = &util::filename_cat ($topdir, "install.cfg");
|
---|
| 218 | if (!open (INSTALLCFG, ">$installcfg")) {
|
---|
[6921] | 219 | &gsprintf($out, "{exportcol.fail} {exportcol.couldnt_create_file}\n", $installcfg);
|
---|
[2075] | 220 | die "\n";
|
---|
| 221 | }
|
---|
| 222 | print INSTALLCFG "CompanyName:New Zealand Digital Library\n";
|
---|
[5920] | 223 | print INSTALLCFG "CollectionName:$cdname\n";
|
---|
| 224 | print INSTALLCFG "CollectionDirName:$cdname\n";
|
---|
[2075] | 225 | print INSTALLCFG "CollectionVersion:1.0\n";
|
---|
| 226 | print INSTALLCFG "CollectionVolume:1\n";
|
---|
| 227 | print INSTALLCFG "ProgramGroupName:Greenstone\n";
|
---|
| 228 | close INSTALLCFG;
|
---|
| 229 |
|
---|
| 230 | # create the manifest.cfg file
|
---|
| 231 | my $manifestcfg = &util::filename_cat ($topdir, "manifest.cfg");
|
---|
| 232 | if (!open (MANIFESTCFG, ">$manifestcfg")) {
|
---|
[6921] | 233 | &gsprintf($out, "{exportcol.fail} {exportcol.couldnt_create_file}\n", $manifestcfg);
|
---|
[2075] | 234 | die "\n";
|
---|
| 235 | }
|
---|
| 236 | print MANIFESTCFG "all:\n";
|
---|
| 237 | print MANIFESTCFG " {library} {collection}\n\n";
|
---|
| 238 | print MANIFESTCFG "library:\n";
|
---|
[2334] | 239 | print MANIFESTCFG " net32 net16 server.exe\n\n";
|
---|
[2075] | 240 | print MANIFESTCFG "database:\n";
|
---|
[5920] | 241 | print MANIFESTCFG ' etc ';
|
---|
[10339] | 242 | foreach my $c (@valid_coll_list) {
|
---|
[5920] | 243 | print MANIFESTCFG "collect\\$c\\index\\text\\$c.ldb ";
|
---|
| 244 | }
|
---|
| 245 | print MANIFESTCFG "\n\n";
|
---|
[2075] | 246 | print MANIFESTCFG "collection:\n";
|
---|
[3730] | 247 | print MANIFESTCFG " collect etc images macros mappings bin\n";
|
---|
[2075] | 248 | close MANIFESTCFG;
|
---|
| 249 |
|
---|
[5837] | 250 | #create the autorun.inf file
|
---|
| 251 | my $autoruninf = &util::filename_cat ($topdir, "Autorun.inf");
|
---|
| 252 | if (!open (AUTORUNINF, ">$autoruninf")) {
|
---|
[6921] | 253 | &gsprintf($out, "{exportcol.fail} {exportcol.couldnt_create_file}\n", $autoruninf);
|
---|
[5837] | 254 | die "\n";
|
---|
| 255 | }
|
---|
[6921] | 256 |
|
---|
[5837] | 257 | print AUTORUNINF "[autorun]\n";
|
---|
| 258 | print AUTORUNINF "OPEN=Setup.exe\n";
|
---|
| 259 | close AUTORUNINF;
|
---|
[6921] | 260 |
|
---|
[2075] | 261 | # copy the necessary stuff from GSDLHOME
|
---|
| 262 | my $imagesdir = &util::filename_cat ($ENV{'GSDLHOME'}, "images");
|
---|
| 263 | my $macrosdir = &util::filename_cat ($ENV{'GSDLHOME'}, "macros");
|
---|
| 264 | my $mappingsdir = &util::filename_cat ($ENV{'GSDLHOME'}, "mappings");
|
---|
| 265 | my $maincfg = &util::filename_cat ($ENV{'GSDLHOME'}, "etc", "main.cfg");
|
---|
| 266 | my $serverexe = &util::filename_cat ($ENV{'GSDLHOME'}, "bin", "windows", "server.exe");
|
---|
[7179] | 267 | #my $gssetupexe = &util::filename_cat ($ENV{'GSDLHOME'}, "bin", "windows", "gssetup.exe"); - have checked this earlier
|
---|
[2075] | 268 | my $setupexe = &util::filename_cat ($ENV{'GSDLHOME'}, "bin", "windows", "Setup.exe");
|
---|
[2334] | 269 | my $net32dir = &util::filename_cat ($ENV{'GSDLHOME'}, "bin", "windows", "net32");
|
---|
| 270 | my $net16dir = &util::filename_cat ($ENV{'GSDLHOME'}, "bin", "windows", "net16");
|
---|
| 271 | my $netscapedir = &util::filename_cat ($ENV{'GSDLHOME'}, "bin", "windows", "netscape");
|
---|
| 272 | my $win32sdir = &util::filename_cat ($ENV{'GSDLHOME'}, "bin", "windows", "Win32s");
|
---|
[3730] | 273 | my $phindjar = &util::filename_cat ($ENV{'GSDLHOME'}, "bin", "java", "Phind.jar");
|
---|
[6813] | 274 | my $gsdlcollageappletjar = &util::filename_cat ($ENV{'GSDLHOME'}, "bin", "java", "GsdlCollageApplet.jar");
|
---|
[2075] | 275 |
|
---|
| 276 | if ((!-d $imagesdir) || (!-d $macrosdir) || (!-d $mappingsdir) || (!-e $maincfg) ||
|
---|
[2334] | 277 | (!-e $serverexe) || (!-e $gssetupexe) || (!-e $setupexe) || (!-d $net32dir) ||
|
---|
[9236] | 278 | (!-d $net16dir) || ($use_netscape && (!-d $netscapedir)) || (!-d $win32sdir) || (!-e $phindjar) ||
|
---|
[6813] | 279 | (!-e $gsdlcollageappletjar)) {
|
---|
[6921] | 280 | &gsprintf($out, "{exportcol.fail} {exportcol.non_exist_files}\n");
|
---|
| 281 | &gsprintf($out, " $imagesdir\n");
|
---|
| 282 | &gsprintf($out, " $macrosdir\n");
|
---|
| 283 | &gsprintf($out, " $mappingsdir\n");
|
---|
| 284 | &gsprintf($out, " $maincfg\n");
|
---|
| 285 | &gsprintf($out, " $serverexe\n");
|
---|
| 286 | &gsprintf($out, " $gssetupexe\n");
|
---|
| 287 | &gsprintf($out, " $setupexe\n");
|
---|
| 288 | &gsprintf($out, " $net32dir\n");
|
---|
| 289 | &gsprintf($out, " $net16dir\n");
|
---|
[9236] | 290 | &gsprintf($out, " $netscapedir\n") if ($use_netscape);
|
---|
[6921] | 291 | &gsprintf($out, " $win32sdir\n");
|
---|
| 292 | &gsprintf($out, " $phindjar\n");
|
---|
| 293 | &gsprintf($out, " $gsdlcollageappletjar\n");
|
---|
[2075] | 294 | die "\n";
|
---|
| 295 | }
|
---|
| 296 |
|
---|
[11178] | 297 | # images. If not using netscape, copy only the top level, not any subdirs
|
---|
| 298 | if ($use_netscape) {
|
---|
| 299 | &util::cp_r ($imagesdir, $gsdldir);
|
---|
| 300 | } else {
|
---|
| 301 | &util::cp_r_toplevel ($imagesdir, $gsdldir);
|
---|
| 302 | }
|
---|
[2075] | 303 | &util::cp_r ($macrosdir, $gsdldir);
|
---|
| 304 | &util::cp_r ($mappingsdir, $gsdldir);
|
---|
| 305 | &util::cp ($maincfg, $etcdir);
|
---|
| 306 | &util::cp ($serverexe, $gsdldir);
|
---|
| 307 | &util::cp ($gssetupexe, $topdir);
|
---|
| 308 | &util::cp ($setupexe, $topdir);
|
---|
[2334] | 309 | &util::cp_r ($net32dir, $gsdldir);
|
---|
| 310 | &util::cp_r ($net16dir, $gsdldir);
|
---|
[9236] | 311 | &util::cp_r ($netscapedir, $topdir) if ($use_netscape);
|
---|
[2334] | 312 | &util::cp_r ($win32sdir, $topdir);
|
---|
[3730] | 313 | &util::cp ($phindjar, $binjavadir);
|
---|
[6813] | 314 | &util::cp ($gsdlcollageappletjar, $binjavadir);
|
---|
[2075] | 315 |
|
---|
[11178] | 316 |
|
---|
| 317 | # if we have netscape 4 bundled, then switch to ns4 compat macro file
|
---|
| 318 | if ($use_netscape) {
|
---|
| 319 | my $main_cfg_file = &util::filename_cat($etcdir, "main.cfg");
|
---|
| 320 | open INFILE, "<$main_cfg_file";
|
---|
| 321 | open OUTFILE, ">$main_cfg_file.tmp";
|
---|
| 322 | my $line;
|
---|
| 323 | while ($line = <INFILE>) {
|
---|
| 324 | if ($line =~ s/nav_css\.dm/nav_ns4\.dm/) {
|
---|
| 325 | print OUTFILE $line;
|
---|
| 326 | last; # stop matching once we have found the line
|
---|
| 327 | } else {
|
---|
| 328 | print OUTFILE "$line";
|
---|
| 329 | }
|
---|
| 330 | }
|
---|
| 331 | # continue with no checking
|
---|
| 332 | while ($line = <INFILE>) {
|
---|
| 333 | print OUTFILE "$line";
|
---|
| 334 | }
|
---|
| 335 | close INFILE;
|
---|
| 336 | close OUTFILE;
|
---|
| 337 | &util::mv("$main_cfg_file.tmp", $main_cfg_file);
|
---|
| 338 | }
|
---|
| 339 |
|
---|
[5849] | 340 | # now change the home.dm macro file to a simple version
|
---|
| 341 | my $newmacrodir = &util::filename_cat ($gsdldir, "macros");
|
---|
| 342 | my $exporthome = &util::filename_cat ($newmacrodir, "exported_home.dm");
|
---|
| 343 | my $oldhome = &util::filename_cat ($newmacrodir, "home.dm");
|
---|
| 344 | if (-e $exporthome) {
|
---|
| 345 | &util::rm($oldhome);
|
---|
| 346 | &util::mv($exporthome, $oldhome);
|
---|
| 347 | }
|
---|
| 348 |
|
---|
[5920] | 349 | # copy the collections over
|
---|
[10339] | 350 | foreach my $c (@valid_coll_list) {
|
---|
[5920] | 351 | #old directories
|
---|
| 352 | my $colldir = &util::filename_cat ($ENV{'GSDLHOME'}, "collect", $c);
|
---|
| 353 | my $colindexdir = &util::filename_cat ($colldir, "index");
|
---|
| 354 | my $coletcdir = &util::filename_cat ($colldir, "etc");
|
---|
| 355 | my $colimagesdir = &util::filename_cat ($colldir, "images");
|
---|
[7951] | 356 | my $colmacrosdir = &util::filename_cat ($colldir, "macros");
|
---|
[5920] | 357 | # new coll directory
|
---|
| 358 | my $newcoldir = &util::filename_cat ($collectdir, $c);
|
---|
[2075] | 359 |
|
---|
[5920] | 360 | &util::mk_all_dir ($newcoldir);
|
---|
| 361 | &util::cp_r ($colindexdir, $newcoldir);
|
---|
| 362 | &util::cp_r ($coletcdir, $newcoldir);
|
---|
| 363 | &util::cp_r ($colimagesdir, $newcoldir) if (-e $colimagesdir);
|
---|
[7951] | 364 | &util::cp_r ($colmacrosdir, $newcoldir) if (-e $colmacrosdir);
|
---|
[5920] | 365 |
|
---|
[6921] | 366 | # now we need to check the collect.cfg file to make sure it's public
|
---|
[5920] | 367 | my $collectcfg = &util::filename_cat ($newcoldir, "etc", "collect.cfg");
|
---|
| 368 | open INFILE, "<$collectcfg";
|
---|
| 369 | open OUTFILE, ">$collectcfg.tmp";
|
---|
[10339] | 370 | my $line;
|
---|
[5920] | 371 | while ($line = <INFILE>) {
|
---|
| 372 | if ($line =~ /^\s*public\s+false/) {
|
---|
| 373 | print OUTFILE "public\ttrue\n";
|
---|
| 374 | last; # stop matching once we have found the line
|
---|
| 375 | } else {
|
---|
| 376 | print OUTFILE "$line";
|
---|
| 377 | }
|
---|
| 378 | }
|
---|
| 379 | # continue with no checking
|
---|
| 380 | while ($line = <INFILE>) {
|
---|
[5846] | 381 | print OUTFILE "$line";
|
---|
| 382 | }
|
---|
[5920] | 383 | close INFILE;
|
---|
| 384 | close OUTFILE;
|
---|
| 385 | &util::mv("$collectcfg.tmp", $collectcfg);
|
---|
[5846] | 386 | }
|
---|
[6054] | 387 | &gsprintf($out, "{exportcol.success}");
|
---|
[6921] | 388 |
|
---|
[6788] | 389 | my $successcolls = "";
|
---|
| 390 | my $first = 1;
|
---|
[10339] | 391 | foreach my $c (@valid_coll_list) {
|
---|
[6788] | 392 | if ($first) {
|
---|
| 393 | $first=0;
|
---|
| 394 | } else {
|
---|
| 395 | $successcolls .=", ";
|
---|
| 396 | }
|
---|
| 397 | $successcolls .= "$c";
|
---|
| 398 | }
|
---|
| 399 |
|
---|
[9236] | 400 | my $gsdl_home = $ENV{'GSDLHOME'};
|
---|
| 401 | my $portable_topdir = $topdir;
|
---|
[9432] | 402 | # Disabled this because it isn't currently useful (the GLI applet doesn't do exporting)
|
---|
| 403 | # It doesn't work on Windows, either
|
---|
| 404 | # $portable_topdir =~ s/$gsdl_home/\$GSDLHOME/g;
|
---|
[9236] | 405 |
|
---|
| 406 | &gsprintf($out, "{exportcol.output_dir}\n", $successcolls, $portable_topdir);
|
---|
[7257] | 407 | &gsprintf($out, "exportcol.pl succeeded:{exportcol.instructions}\n");
|
---|
[2075] | 408 | close OUT if $close_out;
|
---|
| 409 | }
|
---|
[6788] | 410 |
|
---|