View | Details | Raw Unified | Return to bug 74711
Collapse All | Expand All

(-)fastest_cvsup (-8 / +17 lines)
Lines 1-13 Link Here
1
#!/usr/bin/perl
1
#!/usr/bin/perl
2
#-----------------------------------------------------------------------------#
2
#-----------------------------------------------------------------------------#
3
#
3
#
4
#  Find fastest CVSup server script for FreeBSD - version 0.2.8
4
#  Find fastest CVSup server script for FreeBSD - version 0.2.9
5
#  Copyright (c) A.J.Robinson (ajr@subdimension.com) 2002
5
#  Copyright (c) A.J.Robinson (ajr@subdimension.com) 2002
6
#  Distributed under the BSD license.
6
#  Distributed under the BSD license.
7
#
7
#
8
#-----------------------------------------------------------------------------#
8
#-----------------------------------------------------------------------------#
9
#
9
#
10
# Changes:
10
# Changes:
11
# 0.2.9  - added 'us' country code for USA hosts and 'tld' for top-level
12
#          domain machines (can be in any country)
11
# 0.2.8  - fixed the progress meter, timestamped %FREEBSD_SERVERS
13
# 0.2.8  - fixed the progress meter, timestamped %FREEBSD_SERVERS
12
# 0.2.7  - updated documentation, usage message and progress meter.
14
# 0.2.7  - updated documentation, usage message and progress meter.
13
# 0.2.6  - changed from freebsdmirrors.org to the online handbook.
15
# 0.2.6  - changed from freebsdmirrors.org to the online handbook.
Lines 82-88 Link Here
82
  'ca' => 2,    # Canada
84
  'ca' => 2,    # Canada
83
  'cn' => 1,    # China
85
  'cn' => 1,    # China
84
  'cz' => 1,    # Czech Republic
86
  'cz' => 1,    # Czech Republic
85
  'de' => 8,    # Germany
87
  'de' => 7,    # Germany
86
  'dk' => 1,    # Denmark
88
  'dk' => 1,    # Denmark
87
  'ee' => 1,    # Estonia
89
  'ee' => 1,    # Estonia
88
  'es' => 3,    # Spain
90
  'es' => 3,    # Spain
Lines 110-117 Link Here
110
  'tw' => 3,    # Taiwan
112
  'tw' => 3,    # Taiwan
111
  'ua' => 5,    # Ukraine
113
  'ua' => 5,    # Ukraine
112
  'uk' => 5,    # United Kingdom
114
  'uk' => 5,    # United Kingdom
113
  'us' => 17,   # USA
115
  'us' => 18,   # USA
114
  'za' => 2,    # South Africa
116
  'za' => 2,    # South Africa
117
  'tld' => 18,	# Top Level Domain
115
);
118
);
116
119
117
my %OTHER_SERVERS = (
120
my %OTHER_SERVERS = (
Lines 177-182 Link Here
177
        "         -Q           very quiet mode, no progress meter\n",
180
        "         -Q           very quiet mode, no progress meter\n",
178
        "         -r           uses remote server list from FreeBSD Handbook\n",
181
        "         -r           uses remote server list from FreeBSD Handbook\n",
179
        "         -c aa,bb,cc  queries servers in countries aa,bb,cc\n",
182
        "         -c aa,bb,cc  queries servers in countries aa,bb,cc\n",
183
        "            tld       queries servers in the top level domain\n",
180
        "            local     queries servers set as local in the script\n",
184
        "            local     queries servers set as local in the script\n",
181
        "            all       queries all FreeBSD servers\n\n",
185
        "            all       queries all FreeBSD servers\n\n",
182
        "  See the man page, fastest_cvsup(7), for more details.\n\n";
186
        "  See the man page, fastest_cvsup(7), for more details.\n\n";
Lines 307-318 Link Here
307
            unless ( $cc_name{$cc} ) { $cc_name{$cc} = $country }
311
            unless ( $cc_name{$cc} ) { $cc_name{$cc} = $country }
308
          }
312
          }
309
313
310
          # parse US servers
314
          # parse TLD servers
311
315
312
          elsif ( $server =~ /cvsup([\d]*)\.freebsd\.org/i ) {
316
          elsif ( $server =~ /cvsup([\d]*)\.freebsd\.org/i ) {
313
            my $i = $1 || 1;
317
            my $i = $1 || 1;
314
            if ( !$srv{'us'} or $srv{'us'} < $i ) { $srv{'us'} = $i }
318
            if ( !$srv{'tld'} or $srv{'tld'} < $i ) { $srv{'tld'} = $i }
315
            unless ( $cc_name{'us'} ) { $cc_name{'us'} = $country }
319
            unless ( $cc_name{'tld'} ) { $cc_name{'tld'} = $country }
316
          }
320
          }
317
        }
321
        }
318
      }
322
      }
Lines 419-425 Link Here
419
423
420
  for ( my $i=1; $i<=$FREEBSD_SERVERS{$cc}; $i++ ) {
424
  for ( my $i=1; $i<=$FREEBSD_SERVERS{$cc}; $i++ ) {
421
425
422
    if ( $cc eq 'us' ) { # use no country code, include the '1'
426
    if ( $cc eq 'tld' ) { # use no country code, include the '1'
423
      if ( $i == 1 ) { push(@first,"cvsup$i.freebsd.org"); }
427
      if ( $i == 1 ) { push(@first,"cvsup$i.freebsd.org"); }
424
      else           { push(@others,"cvsup$i.freebsd.org"); }
428
      else           { push(@others,"cvsup$i.freebsd.org"); }
425
    }
429
    }
Lines 575-581 Link Here
575
579
576
=head1 SYNOPSIS
580
=head1 SYNOPSIS
577
581
578
B<fastest_cvsup> [B<-h>] [B<-(q|Q)>] [B<-r>] B<-c> (B<country codes>|B<local>|B<all>)
582
B<fastest_cvsup> [B<-h>] [B<-(q|Q)>] [B<-r>] B<-c> (B<country codes>|B<tld>|B<local>|B<all>)
579
583
580
=head1 DESCRIPTION
584
=head1 DESCRIPTION
581
585
Lines 619-624 Link Here
619
623
620
NetBSD and OpenBSD servers are lumped together under the 'netbsd' and
624
NetBSD and OpenBSD servers are lumped together under the 'netbsd' and
621
'openbsd' codes respectively.
625
'openbsd' codes respectively.
626
627
=item B<-c tld>
628
629
checks the servers in the Top Level Domain.  These can be anywhere in the
630
world.
622
631
623
=item B<-c local>
632
=item B<-c local>

Return to bug 74711