[Aberdeen-pm] Downloading a list of RPMS/Debs

ghenry webmaster at perl.me.uk
Thu Jun 23 02:20:39 PDT 2005


A quick one I knocked up last night to fix some RPMS that were missing form upgrading to Fedora Core 4. There's a list of RPMS in <a href="/download/upgrade.log">upgrade.log</a> and the script is called <a href="/downloads/getrpms">getrpms</a>

For laziness, I'll post the code:

#!/usr/bin/perl 
#
# Read in upgrade.log and get missing RPMS, could be debs or whatever.
#
# GH - 22.06.05
#
use warnings;
use strict;
use LWP::Simple;

open(RPMS, "< ", "./upgrade.log")
    or die "File not available for reading: $!\n";

my $url = 'http://download.fedora.redhat.com/pub/fedora/linux/core/4/i386/os/Fedora/RPMS/';

while (<RPMS>) {
    chomp;
    print -e $_ ? "Already downloaded $_\n" : "Downloading $_\n";
    next if (-e $_);
    
    getstore ($url . $_, $_);
  
    print -e $_ ? "got $_\n" : "Download failed for $_\n";

}
close(RPMS);

print "Download complete.\n";

Hope this helps out someone else.

Gavin.




More information about the Aberdeen-pm mailing list