Changeset 14032
- Timestamp:
- 2007-04-30T16:48:18+12:00 (17 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/gsdl/bin/script/mkcol.pl
r13186 r14032 75 75 'type' => "string", 76 76 'reqd' => "no" }, 77 { 'name' => "gs3mode", 78 'desc' => "", 79 'type' => "flag", 80 'reqd' => "no" }, 77 81 { 'name' => "collectdir", 78 82 'desc' => "{mkcol.collectdir}", 79 83 'type' => "string", 80 'deft' => &util::filename_cat ($ENV{'GSDLHOME'}, "collect"), 81 'reqd' => "no" }, 84 'reqd' => "no" }, # For gs3, this collectdir must be provided. 82 85 { 'name' => "public", 83 86 'desc' => "{mkcol.public}", … … 129 132 130 133 # options 131 my ($creator, $optionfile, $maintainer, $ collectdir, $public,134 my ($creator, $optionfile, $maintainer, $gs3mode, $collectdir, $public, 132 135 $title, $about, $plugin, $quiet, $language, $win31compat, $gli); 133 136 … … 140 143 sub traverse_dir 141 144 { 142 my ($modeldir, $coldir ) = @_;145 my ($modeldir, $coldir, $gs3) = @_; 143 146 my ($newfile, @filetext); 144 147 145 148 if (!(-e $coldir)) { 149 146 150 147 151 my $store_umask = umask(0002); … … 163 167 { 164 168 my $thisfile = &util::filename_cat ($modeldir, $file); 169 165 170 if (-d $thisfile) { 166 171 my $colfiledir = &util::filename_cat ($coldir, $file); 167 traverse_dir ($thisfile, $colfiledir );172 traverse_dir ($thisfile, $colfiledir, $gs3); 168 173 169 174 } else { 175 176 # There are only two configuration files in modelcol directory: 177 # collect.cfg and collectionConfig.xml. 178 # If it is gs2, copy collect.cfg file; if gs3, copy collectionConfig.xml. 179 if ( ($gs3 && $file =~ /collect\.cfg/) || (!$gs3 && $file =~ /collectionConfig\.xml/) ) { 180 181 next; 182 } 170 183 my $destfile = $file; 171 184 $destfile =~ s/^modelcol/$collection/; … … 188 201 $line =~ s/\*\*title\*\*/$title/g; 189 202 $line =~ s/\*\*about\*\*/$about/g; 190 $line =~ s/\*\*plugins\*\*/$pluginstring/g; 203 if (!$gs3) { 204 $line =~ s/\*\*plugins\*\*/$pluginstring/g; 205 } 191 206 192 207 print OUTFILE $line; … … 204 219 my $xml = 0; 205 220 221 206 222 my $hashParsingResult = {}; 207 223 my $intArgLeftinAfterParsing = parse2::parse(\@ARGV,$arguments,$hashParsingResult,"allow_extra_options"); … … 324 340 $cdir = &util::filename_cat ($collectdir, $collection); 325 341 } else { 342 if (!$gs3mode) { 326 343 $cdir = &util::filename_cat ($ENV{'GSDLHOME'}, "collect", $collection); 344 }else { 345 &gsprintf(STDOUT, "{mkcol.no_collectdir}\n"); 346 die "In gs3mode, '-collectdir <directory>' must be specified.\n"; 347 } 327 348 } 328 349 … … 339 360 &gsprintf(STDOUT, "\n{mkcol.creating_col}...\n", $collection) 340 361 unless $quiet; 341 &traverse_dir ($mdir, $cdir); 362 363 &traverse_dir ($mdir, $cdir, $gs3mode); 342 364 &gsprintf(STDOUT, "\n{mkcol.success}\n", $cdir) 343 365 unless $quiet;
Note:
See TracChangeset
for help on using the changeset viewer.