I don't know if this is useful to anyone else besides me, but just in case:

Sometimes, when files are updated on a mirror but the hdlist isn't (or you're 
in the middle of a long download, or whatever), you can't get them through 
urpmi. But, if you're using ftp sources, you can just ncftp to the site and 
get the newer versions manually.

In rpmdrake, you can see which source the package comes from (for example, 
"main-cooker," or whatever you called it when using urpmi.update or 
urpmi.setup). But you probably don't know the URL for main-cooker off the top 
of your head, and wouldn't want to type it even if you did.

That's where ncftp bookmarks come in. You can create an ncftp bookmark for 
each of your sources, and just type "ncftp main-cooker" to go right to it. I 
did this manually, but each time a new version comes out, or your favorite 
mirror rearranges their paths (e.g., moving 9.0 from mandrake to 
mandrake-old), you have to update it in two places (urpmi and ncftp). And I 
have a ton of sources.

So I wrote a script to automate this.

Cut and paste the end of this message as urpmi2ncftp, then do this:
  chmod +x urpmi2ncftp
  ./urpmi2ncftp >> ~/.ncftp/bookmarks

Then you can type "ncftp main-cooker" (assuming you have a urpmi source called 
main-cooker) and you're there.

Of course this only works with ftp sources. If you're using rsync or http or 
even ftp with authentication, you're SOL. (My local copy of the script knows 
how to convert mirrors.secsup.org's rsync URLs to the appropriate ftp paths, 
but there's no general way to do that....)

So, here's the script:

--- CUT HERE ---

#!/usr/bin/perl

use strict;
use urpm;
use URI;
use Socket;

my $urpm = new urpm;
$urpm->read_config();
foreach my $media (@{$urpm->{media}}) {
    my $uri = URI->new($media->{url});
    if ($uri->scheme eq "ftp") {
        print($media->{name} . "," .
              $uri->host . ",,,," .
              $uri->path . "," .
              "I," .
              $uri->port . ",4294967295,1,1,-1,1," .
              inet_ntoa(scalar gethostbyname($uri->host)) . 
              ",,,,,,S,-1,\n");
    }
}


Reply via email to