ViewVC Help
View File | Revision Log | Show Annotations | Download File
/cvs/deliantra/server/utils/cfutil.in
(Generate patch)

Comparing deliantra/server/utils/cfutil.in (file contents):
Revision 1.36 by root, Sun Jun 10 02:51:46 2007 UTC vs.
Revision 1.41 by root, Mon Jul 16 19:49:34 2007 UTC

92 if (!-f "$path/regions") { 92 if (!-f "$path/regions") {
93 warn "'$path' does not look like a maps directory ('regions' file is missing).\n"; 93 warn "'$path' does not look like a maps directory ('regions' file is missing).\n";
94 exit 1 unless $FORCE; 94 exit 1 unless $FORCE;
95 } 95 }
96 96
97 system $RSYNC, "-av", "$path/.", "$DATADIR/maps/.", "--delete", "--exclude", "CVS", "--delete-excluded" 97 system $RSYNC, "-a", "--chmod=u=rwX,go=rX", "$path/.", "$DATADIR/maps/.", "--delete", "--exclude", "CVS", "--delete-excluded"
98 and die "map installation failed.\n"; 98 and die "map installation failed.\n";
99 99
100 print "maps installed successfully.\n"; 100 print "maps installed successfully.\n";
101} 101}
102 102
103{ 103{
104 our %ANIMINFO; 104 our %ANIMINFO;
105 our %FACEINFO; 105 our %FACEINFO;
106 our %RESOURCE;
106 our @ARC; 107 our @ARC;
107 our %ARC; 108 our %ARC;
108 our $TRS; 109 our $TRS;
109 our $NFILE; 110 our $NFILE;
111 our $PATH;
110 112
111 our $QUANTIZE = "+dither -colorspace RGB -colors 256"; 113 our $QUANTIZE = "+dither -colorspace RGB -colors 256";
112 114
113 our (@png, @trs, @arc); # files we are interested in 115 our (@png, @trs, @arc, @res); # files we are interested in
114 116
115 sub commit_png($$$) { 117 sub commit_png($$$) {
116 my ($name, $data, $T) = @_; 118 my ($name, $data, $T) = @_;
117 119
118 $FACEINFO{$name}{"data$T"} = $data; 120 $FACEINFO{$name}{"data$T"} = $data;
383 385
384 $TRS .= $trs; 386 $TRS .= $trs;
385 } 387 }
386 } 388 }
387 389
390 sub process_res {
391 while (@res) {
392 my ($dir, $file) = @{pop @res};
393
394 my $data;
395 aio_load "$dir/$file", $data;
396
397 my $copyright;
398 aio_load "$dir/copyright", $copyright;
399
400 $file =~ s/\.res$//;
401 $file =~ /\.([^.]+)$/
402 or next;
403
404 my $type = $1;
405
406 substr $dir, 0, 1 + length $PATH, "";
407
408 $RESOURCE{"$dir/$file"} = {
409 type => $1,
410 copyright => $copyright,
411 data => $data,
412 chksum => Digest::MD5::md5 $data,
413 };
414 }
415 }
416
388 sub find_files; 417 sub find_files;
389 sub find_files { 418 sub find_files {
390 my ($path) = @_; 419 my ($path) = @_;
391 420
392 IO::AIO::aioreq_pri 4; 421 IO::AIO::aioreq_pri 4;
401 push @png, ["$path/$file", 0]; 430 push @png, ["$path/$file", 0];
402 } elsif ($file =~ /\.trs$/) { 431 } elsif ($file =~ /\.trs$/) {
403 push @trs, [$path, $file]; 432 push @trs, [$path, $file];
404 } elsif ($file =~ /\.arc$/) { 433 } elsif ($file =~ /\.arc$/) {
405 push @arc, [$path, $file]; 434 push @arc, [$path, $file];
435 } elsif ($file =~ /\.(ogg|jpg|res)$/) {
436 push @res, [$path, $file];
406 } else { 437 } else {
407 warn "ignoring $path/$file\n" if $VERBOSE >= 3; 438 warn "ignoring $path/$file\n" if $VERBOSE >= 3;
408 } 439 }
409 } 440 }
410 }; 441 };
411 } 442 }
412 443
413 sub inst_arch($) { 444 sub inst_arch($) {
414 my (undef, $path) = @_; 445 my (undef, $path) = @_;
446
447 $PATH = $path;
415 448
416 print "\n", 449 print "\n",
417 "Installing '$path' to '$DATADIR'\n", 450 "Installing '$path' to '$DATADIR'\n",
418 "\n", 451 "\n",
419 "This can take a long time if you run this\n", 452 "This can take a long time if you run this\n",
434 $_->join for ( 467 $_->join for (
435 # four png crunchers work fine for my 2x smp machine 468 # four png crunchers work fine for my 2x smp machine
436 (async \&process_png), (async \&process_png), (async \&process_png), (async \&process_png), 469 (async \&process_png), (async \&process_png), (async \&process_png), (async \&process_png),
437 (async \&process_trs), (async \&process_trs), 470 (async \&process_trs), (async \&process_trs),
438 (async \&process_arc), (async \&process_arc), 471 (async \&process_arc), (async \&process_arc),
472 (async \&process_res), (async \&process_res),
439 ); 473 );
440 474
441 { 475 {
442 # remove path prefix from editor_folder 476 # remove path prefix from editor_folder
443 substr $_->{editor_folder}, 0, 1 + length $path, "" 477 substr $_->{editor_folder}, 0, 1 + length $path, ""
511 545
512 print $fh freeze { 546 print $fh freeze {
513 version => 2, 547 version => 2,
514 faceinfo => \%FACEINFO, 548 faceinfo => \%FACEINFO,
515 animinfo => \%ANIMINFO, 549 animinfo => \%ANIMINFO,
550 resource => \%RESOURCE,
516 }; 551 };
517 } 552 }
518 553
519 for (qw(archetypes facedata treasures)) { 554 for (qw(archetypes facedata treasures)) {
520 chmod 0644, "$DATADIR/$_~"; 555 chmod 0644, "$DATADIR/$_~";

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines