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.12 by root, Mon Mar 12 17:26:41 2007 UTC vs.
Revision 1.17 by root, Wed Mar 14 16:23:26 2007 UTC

20use Crossfire; 20use Crossfire;
21use Coro; 21use Coro;
22use Coro::AIO; 22use Coro::AIO;
23use POSIX (); 23use POSIX ();
24use Digest::MD5; 24use Digest::MD5;
25use Storable; $Storable::canonical = 1;
25 26
26sub usage { 27sub usage {
27 warn <<EOF; 28 warn <<EOF;
28Usage: cfutil [-v] [-q] [--force] [--cache] 29Usage: cfutil [-v] [-q] [--force] [--cache]
29 [--install-arch path] 30 [--install-arch path]
67} 68}
68 69
69sub inst_maps($) { 70sub inst_maps($) {
70 my (undef, $path) = @_; 71 my (undef, $path) = @_;
71 72
72 print "installing '$path' to '$DATADIR/maps'\n\n"; 73 print "installing '$path' to '$DATADIR/maps'\n";
73 74
74 if (!-f "$path/regions") { 75 if (!-f "$path/regions") {
75 warn "'$path' does not look like a maps directory ('regions' file is missing).\n"; 76 warn "'$path' does not look like a maps directory ('regions' file is missing).\n";
76 exit 1 unless $FORCE; 77 exit 1 unless $FORCE;
77 } 78 }
78 79
79 system $RSYNC, "-av", "$path/.", "$DATADIR/maps/.", "--delete", "--exclude", "CVS", "--delete-excluded"; 80 system $RSYNC, "-av", "$path/.", "$DATADIR/maps/.", "--delete", "--exclude", "CVS", "--delete-excluded"
81 and die "map installation failed.\n";
82
83 print "maps installed successfully.\n";
80} 84}
81 85
82{ 86{
83 our %PNG32; 87 our %PNG32;
84 our %FACEINFO; 88 our %FACEINFO;
85 our @ARC; 89 our @ARC;
86 our $TRS; 90 our $TRS;
87 our $NFILE; 91 our $NFILE;
88 our %ANIM; 92 our %ANIM;
89 our $SMOOTH;
90 93
91 our (@png, @trs, @arc); # files we are interested in 94 our (@png, @trs, @arc); # files we are interested in
92 95
93 sub commit_png { 96 sub commit_png {
94 my ($name, $data) = @_; 97 my ($name, $data) = @_;
254 $info->{visibility} = $visibility if defined $visibility; 257 $info->{visibility} = $visibility if defined $visibility;
255 $info->{magicmap} = $magicmap if defined $magicmap; 258 $info->{magicmap} = $magicmap if defined $magicmap;
256 } 259 }
257 260
258 if (my $smooth = delete $o->{smoothface}) { 261 if (my $smooth = delete $o->{smoothface}) {
259 $SMOOTH .= "$smooth\n"; 262 my ($face, $smooth) = split /\s+/, $smooth;
263 # skip empty_S.x11, it seems to server no purpose whatsoever
264 # but increases bandwidth demands and worse.
265 unless ($smooth eq "empty_S.x11") {
266 $FACEINFO{$face}{smooth} = $smooth;
267 }
260 } 268 }
261 } 269 }
262 } 270 }
263 } 271 }
264 } 272 }
304 } 312 }
305 313
306 sub inst_arch($) { 314 sub inst_arch($) {
307 my (undef, $path) = @_; 315 my (undef, $path) = @_;
308 316
309 print "installing '$path' to '$DATADIR'\n\n"; 317 print "installing '$path' to '$DATADIR'\n";
310 318
311 if (!-d "$path/treasures") { 319 if (!-d "$path/treasures") {
312 warn "'$path' does not look like an arch directory ('treasures' directory is missing).\n"; 320 warn "'$path' does not look like an arch directory ('treasures' directory is missing).\n";
313 exit 1 unless $FORCE; 321 exit 1 unless $FORCE;
314 } 322 }
334 substr $_->{editor_folder}, 0, 1 + length $path, "" for @ARC; 342 substr $_->{editor_folder}, 0, 1 + length $path, "" for @ARC;
335 print $fh Crossfire::archlist_to_string \@ARC; 343 print $fh Crossfire::archlist_to_string \@ARC;
336 } 344 }
337 345
338 { 346 {
339 open my $fh, ">:utf8", "$DATADIR/smooth~"
340 or die "$DATADIR/smooth~: $!";
341 print $fh $SMOOTH;
342 }
343
344 {
345 open my $fh, ">:utf8", "$DATADIR/treasures~" 347 open my $fh, ">:utf8", "$DATADIR/treasures~"
346 or die "$DATADIR/treasures~: $!"; 348 or die "$DATADIR/treasures~: $!";
347 print $fh $TRS; 349 print $fh $TRS;
348 } 350 }
349 351
359 } 361 }
360 362
361 open my $fh, ">:perlio", "$DATADIR/faces~" 363 open my $fh, ">:perlio", "$DATADIR/faces~"
362 or die "$DATADIR/faces~: $!"; 364 or die "$DATADIR/faces~: $!";
363 365
366 $FACEINFO{""} = { version => 1};
364 print $fh Storable::nfreeze \%FACEINFO; 367 print $fh Storable::nfreeze \%FACEINFO;
365 } 368 }
366 369
367 for (qw(archetypes faces animations treasures smooth)) { 370 for (qw(archetypes faces animations treasures)) {
368 chmod 0644, "$DATADIR/$_~"; 371 chmod 0644, "$DATADIR/$_~";
369 rename "$DATADIR/$_~", "$DATADIR/$_"; 372 rename "$DATADIR/$_~", "$DATADIR/$_"
373 or die "$DATADIR/$_: $!";
370 } 374 }
375
376 print "archetype data installed successfully.\n";
371 } 377 }
372} 378}
373 379
374Getopt::Long::Configure ("bundling", "no_ignore_case"); 380Getopt::Long::Configure ("bundling", "no_ignore_case");
375GetOptions ( 381GetOptions (

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines