From f2382f77a120e39b7b29493b961b2af1709833e3 Mon Sep 17 00:00:00 2001 From: curt Date: Wed, 12 Nov 2003 22:16:03 +0000 Subject: [PATCH] Various changes and updates. --- src/Utils/cdrom/make-cd-image | 33 +++++ src/Utils/cdrom/mk-mklayout-script.pl | 21 +++- src/Utils/download-map/download-map.pl | 162 +++++++++++++++---------- 3 files changed, 146 insertions(+), 70 deletions(-) create mode 100755 src/Utils/cdrom/make-cd-image diff --git a/src/Utils/cdrom/make-cd-image b/src/Utils/cdrom/make-cd-image new file mode 100755 index 00000000..063e39b0 --- /dev/null +++ b/src/Utils/cdrom/make-cd-image @@ -0,0 +1,33 @@ +#!/bin/sh + +VERSION=0.9.2 +SOURCE=$1 +VOLUME_ID=FG_Scenery_${SOURCE}_v${VERSION} +PUBLISHER=curt@flightgear.org +PREPAIRER=curt@flightgear.org +# COPYRIGHT="Copyright (C) 2002 Curtis L. Olson" +OUTPUT_IMG=/data1/images/${SOURCE}-${VERSION}.img + +# -f = follow symbolic links (the image directories are link trees) +# -r = Rock Ridge protocol +# -J -jcharset default = Joliet extensions +# -l = allow full 31 character filenames +# -D = do not use deep directory relocation +# -L = allow IOS9660 filenames to begin with a period +# -apple = Add Apple extensions. +# -probe = Test each file for it's Mac creator/type + +OPTIONS="-f -r -J -jcharset default -l -D -L" + +COMMAND="mkisofs $OPTIONS -V $VOLUME_ID -P $PUBLISHER -p $PREPAIRER \ + -apple -probe \ + -o $OUTPUT_IMG $SOURCE" + +echo running: +echo $COMMAND +$COMMAND + +echo +echo "To examine the image before burning a cd:" +echo +echo "mount $OUTPUT_IMG /mnt -t iso9660 -o loop=/dev/loop3,blocksize=1024" diff --git a/src/Utils/cdrom/mk-mklayout-script.pl b/src/Utils/cdrom/mk-mklayout-script.pl index 7b51a751..cf584f2e 100755 --- a/src/Utils/cdrom/mk-mklayout-script.pl +++ b/src/Utils/cdrom/mk-mklayout-script.pl @@ -1,8 +1,16 @@ #!/usr/bin/perl -$layout_master = "./layout-0.9.2"; $source = "/stage/fgfs03/curt/Scenery-0.9.2"; -$dest = "./Images"; + +$layout_master = shift( @ARGV ); +$dest = shift( @ARGV ); + +if ( $layout_master eq "" ) { + $layout_master = "./layout-disks-0.9.2"; +} +if ( $dest eq "" ) { + $dest = "./Images"; +} @rawfiles = `ls $source/*`; @@ -14,7 +22,14 @@ while ( ) { push( @layout, $_ ); } -system( "/bin/rm -rf $dest" ); +print "Delete current $dest (y/N): "; +$response = ; +chomp($response); +if ( $response eq "y" || $response eq "Y" ) { + system( "/bin/rm -rf $dest" ); +} else { + die "Stopped with no action.\n"; +} foreach $file ( @layout ) { $base = $file; diff --git a/src/Utils/download-map/download-map.pl b/src/Utils/download-map/download-map.pl index 80011983..2c4d0fc6 100755 --- a/src/Utils/download-map/download-map.pl +++ b/src/Utils/download-map/download-map.pl @@ -2,18 +2,21 @@ use GD; +$version = "0.9.2"; if ( $#ARGV < 0 ) { - $scenerydir = "/stage/fgfs01/ftp/pub/fgfs/Scenery"; -} else { - $scenerydir = shift(@ARGV); + push( @ARGV, "/stage/fgfs01/ftp/pub/fgfs/Scenery-" . $version ); } + +$ftpurl = "ftp://ftp.flightgear.org/pub/fgfs/Scenery-" . $version; +$htmlout = "scenery-" . $version . ".html"; +$mapout = "map-" . $version . ".png"; $outputdir = "mapresult/"; $daysecs = 3600*24; # load raw image -open( INPUT, "rawmap.gif" ) || die "cannot open raw image\n"; -$im = newFromGif GD::Image( INPUT ); +open( INPUT, "rawmap.png" ) || die "cannot open raw image\n"; +$im = newFromPng GD::Image( INPUT ); ($width, $height) = $im->getBounds(); close( INPUT ); @@ -50,86 +53,111 @@ $im->line( $width / 2, 0, $width / 2, $height, $red3 ); $im->line( 0, $height / 2, $width, $height / 2, $red3 ); # create html file -open ( HTML, ">$outputdir/world-scenery.html" ) || - die "cannot open $outputdir/world-scenery.html\n"; +open ( HTML, ">$outputdir/$htmlout" ) || + die "cannot open $outputdir/$htmlout\n"; print HTML "\n"; -print HTML "FGFS Scenery Downloads\n"; +print HTML "FGFS Scenery Downloads Version $version\n"; print HTML "\n"; -print HTML "FGFS Scenery Downloads Version $version\n"; +print HTML "Click on any of the 10x10 degree chunks in the image below to\n"; +print HTML "download that area.
\n"; +print HTML "An area with no corresponding link means that area is all ocean\n"; +print HTML "so there is nothing to download. (Or if a rebuild is in\n"; +print HTML "progress, that chunk may not yet be generated.)\n"; +print HTML "

\n"; +print HTML "\n"; print HTML "\n"; -@files = `ls $scenerydir/*.tar.gz`; +$toggle = 0; +foreach $dir ( @ARGV ) { + @files = `ls $dir/*.tar.gz`; -foreach $file ( @files ) { - chop($file); + foreach $file ( @files ) { + chop($file); - ($dev, $ino, $mode, $nlink, $uid, $gid, $rdev, $size, $atime, - $mtime, $ctime, $blksize, $blocks) = stat($file); + ($dev, $ino, $mode, $nlink, $uid, $gid, $rdev, $size, $atime, + $mtime, $ctime, $blksize, $blocks) = stat($file); - $mb = $size / (1024*1024); - # print "$file size = $mb\n"; + $mb = $size / (1024*1024); + # print "$file size = $mb\n"; - # recover the modification date from the stat - ($sec, $min, $hour, $mday, $mon, $year, $wday, $yday, $isdst) = - localtime($mtime); + # recover the modification date from the stat + ($sec, $min, $hour, $mday, $mon, $year, $wday, $yday, $isdst) = + localtime($mtime); - $date = sprintf("%2d/%02d/%02d", $mon + 1, $mday, 1900 + $year); + $date = sprintf("%2d/%02d/%02d", $mon + 1, $mday, 1900 + $year); - $age = (time() - $mtime) / $daysecs; + $age = (time() - $mtime) / $daysecs; - if ( $age < 7 ) { - $color1 = $green1; - $color2 = $green2; - } elsif ( $age < 14 ) { - $color1 = $yellow1; - $color2 = $yellow2; - } else { - $color1 = $orange1; - $color2 = $orange2; + if ( !$toggle ) { + if ( $age < 7 ) { + $color1 = $green1; + $color2 = $green2; + } elsif ( $age < 14 ) { + $color1 = $yellow1; + $color2 = $yellow2; + } else { + $color1 = $orange1; + $color2 = $orange2; + } + } else { + if ( $age < 7 ) { + $color1 = $orange1; + $color2 = $orange2; + } elsif ( $age < 14 ) { + $color1 = $yellow1; + $color2 = $yellow2; + } else { + $color1 = $orange1; + $color2 = $orange2; + } + } + + $file =~ s/.*\///g; + $file =~ s/.tar.gz//; + # print "$file\n"; + ($ew, $lon, $ns, $lat) = $file =~ m/(\w)(\d\d\d)(\w)(\d\d)/; + # print "$ew $lon, $ns, $lat\n"; + + if ( $ew eq "w" ) { + $lon = $lon * -1; + } else { + $lon = $lon * 1; + } + + if ( $ns eq "s" ) { + $lat = $lat * -1; + } else { + $lat = $lat * 1; + } + + # print "$lon $lat\n"; + $x1 = ($lon + 180) * $xstep / 10.0; + $y1 = $height - ($lat + 90) * $ystep / 10.0; + $x2 = ($lon + 10 + 180) * $xstep / 10.0; + $y2 = $height - ($lat + 10 + 90) * $ystep / 10.0; + + $im->line($x1, $y1, $x2, $y2, $color1); + $im->line($x1, $y2, $x2, $y1, $color1); + $im->rectangle($x1, $y1, $x2, $y2, $color2); + + # $y1 = $height - $y1; + # $y2 = $height - $y2; + print HTML "\n", $file, $mb); } - $file =~ s/.*\///g; - $file =~ s/.tar.gz//; - # print "$file\n"; - ($ew, $lon, $ns, $lat) = $file =~ m/(\w)(\d\d\d)(\w)(\d\d)/; - # print "$ew $lon, $ns, $lat\n"; - - if ( $ew eq "w" ) { - $lon = $lon * -1; - } else { - $lon = $lon * 1; - } - - if ( $ns eq "s" ) { - $lat = $lat * -1; - } else { - $lat = $lat * 1; - } - - # print "$lon $lat\n"; - $x1 = ($lon + 180) * $xstep / 10.0; - $y1 = $height - ($lat + 90) * $ystep / 10.0; - $x2 = ($lon + 10 + 180) * $xstep / 10.0; - $y2 = $height - ($lat + 10 + 90) * $ystep / 10.0; - - $im->line($x1, $y1, $x2, $y2, $color1); - $im->line($x1, $y2, $x2, $y1, $color1); - $im->rectangle($x1, $y1, $x2, $y2, $color2); - - # $y1 = $height - $y1; - # $y2 = $height - $y2; - print HTML "\n", $file, $mb); + $toggle = !$toggle; } # write out gif -$gif_data = $im->gif; -open( OUTPUT, ">$outputdir/download-map.gif" ) || - die "cannot open output $outputdir/download-map.gif\n"; +$png_data = $im->png; +open( OUTPUT, ">$outputdir/$mapout" ) || + die "cannot open output $outputdir/$mapout\n"; binmode OUTPUT; -print OUTPUT $gif_data; +print OUTPUT $png_data; close OUTPUT; # finish off html file