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.40 by root, Mon Jul 16 19:43:33 2007 UTC vs.
Revision 1.44 by root, Tue Jul 24 04:55:35 2007 UTC

21use Crossfire; 21use Crossfire;
22use Coro; 22use Coro;
23use Coro::AIO; 23use Coro::AIO;
24use POSIX (); 24use POSIX ();
25use Digest::MD5; 25use Digest::MD5;
26use Carp;
26use Coro::Storable; $Storable::canonical = 1; 27use Coro::Storable; $Storable::canonical = 1;
28
29$SIG{QUIT} = sub { Carp::cluck "QUIT" };
27 30
28sub usage { 31sub usage {
29 warn <<EOF; 32 warn <<EOF;
30Usage: cfutil [-v] [-q] [--force] [--cache] 33Usage: cfutil [-v] [-q] [--force] [--cache]
31 [--install-arch path] 34 [--install-arch path]
92 if (!-f "$path/regions") { 95 if (!-f "$path/regions") {
93 warn "'$path' does not look like a maps directory ('regions' file is missing).\n"; 96 warn "'$path' does not look like a maps directory ('regions' file is missing).\n";
94 exit 1 unless $FORCE; 97 exit 1 unless $FORCE;
95 } 98 }
96 99
97 system $RSYNC, "-av", "--chmod=u=rwX,go=rX", "$path/.", "$DATADIR/maps/.", "--delete", "--exclude", "CVS", "--delete-excluded" 100 system $RSYNC, "-a", "--chmod=u=rwX,go=rX", "$path/.", "$DATADIR/maps/.", "--delete", "--exclude", "CVS", "--delete-excluded"
98 and die "map installation failed.\n"; 101 and die "map installation failed.\n";
99 102
100 print "maps installed successfully.\n"; 103 print "maps installed successfully.\n";
101} 104}
102 105
387 } 390 }
388 } 391 }
389 392
390 sub process_res { 393 sub process_res {
391 while (@res) { 394 while (@res) {
392 my ($dir, $file) = @{pop @res}; 395 my ($dir, $file, $type) = @{pop @res};
393 396
394 my $data; 397 my $data;
395 aio_load "$dir/$file", $data; 398 aio_load "$dir/$file", $data;
396 399
397 my $copyright; 400 my $copyright;
399 402
400 $file =~ s/\.res$//; 403 $file =~ s/\.res$//;
401 $file =~ /\.([^.]+)$/ 404 $file =~ /\.([^.]+)$/
402 or next; 405 or next;
403 406
404 my $type = $1;
405
406 substr $dir, 0, 1 + length $PATH, ""; 407 substr $dir, 0, 1 + length $PATH, "";
407 408
408 $RESOURCE{"$dir/$file"} = { 409 $RESOURCE{"$dir/$file"} = {
409 type => $1, 410 type => $type,
410 copyright => $copyright, 411 copyright => $copyright,
411 data => $data, 412 data => $data,
412 chksum => Digest::MD5::md5 $data, 413 chksum => Digest::MD5::md5 $data,
413 }; 414 };
414 } 415 }
423 my ($dirs, $nondirs) = @_; 424 my ($dirs, $nondirs) = @_;
424 425
425 find_files "$path/$_" 426 find_files "$path/$_"
426 for grep $_ !~ /^(?:CVS|dev)$/, @$dirs; 427 for grep $_ !~ /^(?:CVS|dev)$/, @$dirs;
427 428
429 my $dir = $path;
430 substr $dir, 0, 1 + length $PATH, "";
431
428 for my $file (@$nondirs) { 432 for my $file (@$nondirs) {
433 if ($dir =~ /^music(?:\/|$)/) {
434 push @res, [$path, $file, 3] # FT_MUSIC
435 if $file =~ /\.(ogg)$/;
436
437 } elsif ($dir =~ /^sounds(?:\/|$)/) {
438 push @res, [$path, $file, 5] # FT_SOUND
439 if $file =~ /\.(wav|ogg)$/;
440
441 } elsif ($dir =~ /^res(?:\/|$)/) {
442 push @res, [$path, $file, 0] # FT_FACE
443 if $file =~ /\.(jpg|png)$/;
444 push @res, [$path, $file, 7] # FT_RSRC
445 if $file =~ /\.(res)$/;
446
429 if ($file =~ /\.png$/) { 447 } elsif ($file =~ /\.png$/) {
430 push @png, ["$path/$file", 0]; 448 push @png, ["$path/$file", 0];
449
431 } elsif ($file =~ /\.trs$/) { 450 } elsif ($file =~ /\.trs$/) {
432 push @trs, [$path, $file]; 451 push @trs, [$path, $file];
452
433 } elsif ($file =~ /\.arc$/) { 453 } elsif ($file =~ /\.arc$/) {
434 push @arc, [$path, $file]; 454 push @arc, [$path, $file];
435 } elsif ($file =~ /\.(ogg|jpg|res)$/) { 455
436 push @res, [$path, $file];
437 } else { 456 } else {
438 warn "ignoring $path/$file\n" if $VERBOSE >= 3; 457 warn "ignoring $path/$file\n" if $VERBOSE >= 3;
439 } 458 }
440 } 459 }
441 }; 460 };

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines