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.37 by root, Tue Jul 10 16:24:00 2007 UTC vs.
Revision 1.43 by root, Mon Jul 23 23:38:18 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", "$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
392 my ($dir, $file) = @{pop @res}; 395 my ($dir, $file) = @{pop @res};
393 396
394 my $data; 397 my $data;
395 aio_load "$dir/$file", $data; 398 aio_load "$dir/$file", $data;
396 399
400 my $copyright;
401 aio_load "$dir/copyright", $copyright;
402
397 $file =~ s/\.res$//; 403 $file =~ s/\.res$//;
398 $file =~ /\.([^.]+)$/ 404 $file =~ /\.([^.]+)$/
399 or next; 405 or next;
400 406
401 my $type = $1; 407 my $type = $1;
402 408
403 substr $dir, 0, 1 + length $PATH, ""; 409 substr $dir, 0, 1 + length $PATH, "";
404 410
405 $RESOURCE{"$dir/$file"} = { 411 $RESOURCE{"$dir/$file"} = {
406 type => $1, 412 type => $1,
407 copyright => "", # TODO 413 copyright => $copyright,
408 data => $data, 414 data => $data,
409 chksum => Digest::MD5::md5 $data, 415 chksum => Digest::MD5::md5 $data,
410 }; 416 };
411 } 417 }
412 } 418 }
420 my ($dirs, $nondirs) = @_; 426 my ($dirs, $nondirs) = @_;
421 427
422 find_files "$path/$_" 428 find_files "$path/$_"
423 for grep $_ !~ /^(?:CVS|dev)$/, @$dirs; 429 for grep $_ !~ /^(?:CVS|dev)$/, @$dirs;
424 430
431 my $dir = $path;
432 substr $dir, 0, 1 + length $PATH, "";
433
425 for my $file (@$nondirs) { 434 for my $file (@$nondirs) {
435 if ($file =~ /\.(ogg|jpg|res)$/ || $dir =~ /^res(?:\/|$)/) {
436 push @res, [$path, $file];
426 if ($file =~ /\.png$/) { 437 } elsif ($file =~ /\.png$/) {
427 push @png, ["$path/$file", 0]; 438 push @png, ["$path/$file", 0];
428 } elsif ($file =~ /\.trs$/) { 439 } elsif ($file =~ /\.trs$/) {
429 push @trs, [$path, $file]; 440 push @trs, [$path, $file];
430 } elsif ($file =~ /\.arc$/) { 441 } elsif ($file =~ /\.arc$/) {
431 push @arc, [$path, $file]; 442 push @arc, [$path, $file];
432 } elsif ($file =~ /\.(ogg|res)$/) {
433 push @res, [$path, $file];
434 } else { 443 } else {
435 warn "ignoring $path/$file\n" if $VERBOSE >= 3; 444 warn "ignoring $path/$file\n" if $VERBOSE >= 3;
436 } 445 }
437 } 446 }
438 }; 447 };

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines