#!/usr/bin/perl # # Fedora Open Mirror Check 0.1.0 # # (c) 2004-2008 by Robert Scheck # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License, or # (at your option) any later version. # # This program is distributed in the hope that it will be useful, # but WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the # GNU General Public License for more details. # # You should have received a copy of the GNU General Public License # along with this program; if not, write to the Free Software # Foundation, Inc., # 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. # use strict; use LWP::UserAgent; my $release = 11; my @mirrorlists = ("http://mirrors.fedoraproject.org/mirrorlist?path=pub/fedora/linux/releases/test/$release-Preview&country=global", "http://mirrors.fedoraproject.org/mirrorlist?path=pub/fedora/linux/releases/test/$release-Beta&country=global", "http://mirrors.fedoraproject.org/mirrorlist?path=pub/fedora/linux/releases/test/$release-Alpha&country=global", "http://mirrors.fedoraproject.org/mirrorlist?path=pub/fedora/linux/releases/" . ($release - 1) . "&country=global"); my @install_archs = ("i386", "x86_64", "ppc"); my @live_archs = ("i686", "x86_64"); my $useragent = "Fedora $release Open Mirror Check (kevin\@fedoraproject.org)"; my @mirrorservers; foreach my $mirrorlist (@mirrorlists) { my $ua = LWP::UserAgent->new(agent => $useragent); my $result = $ua->get($mirrorlist) or print("Warning: $mirrorlist is not reachable!"); if($result->is_success) { foreach my $mirror (split("\n", $result->content)) { next if($mirror =~ /^\s*#/); $mirror =~ s/(releases)\/.*/$1/; push(@mirrorservers, $mirror) if(!grep($mirror eq $_, @mirrorservers)); } } else { print("Warning: " . $result->status_line); } } foreach my $mirror (@mirrorservers) { foreach my $arch (@install_archs) { my $ua = LWP::UserAgent->new(agent => $useragent); my $result = $ua->get($mirror . "/$release/Fedora/$arch/iso/SHA1SUM") or print("Warning: $mirror seems to be down!\n"); if($result->is_success) { if($result->content =~ /BEGIN PGP SIGNED MESSAGE/) { print("$mirror/$release/Fedora/$arch/iso/SHA1SUM is already open!\n"); } } } foreach my $arch (@live_archs) { my $ua = LWP::UserAgent->new(agent => $useragent); my $result = $ua->get($mirror . "/$release/Live/$arch/SHA1SUM") or print("Warning: $mirror seems to be down!\n"); if($result->is_success) { if($result->content =~ /BEGIN PGP SIGNED MESSAGE/) { print("$mirror/$release/Live/$arch/SHA1SUM is already open!\n"); } } } }