emerge -fp downloader
So I've decided to first run emerge -De system && emerge -De world which should reinstall the whole system. Since my server is not online I have to get the sources from somewhere. So I generated with emerge -pfDe system 2> list a list of all the source packages that have to be downloaded an following small script that should fetch them all on a different machine :-)
#!/usr/bin/perl
if (@ARGV == 0){
print "downloadlist.pl filelist\n";
}
my $file = $ARGV[0];
open(FILE,"< $file") or die("Couldn't open input file");
if (not -f "distfiles"){
mkdir "distfiles";
}
download: while(<FILE>){
if (/^$/){
next;
}
else {
my @candidates = split / /, $_;
my @filename = split(/\//,@candidates[0]);
my $filename = $filename[@filename-1];
foreach $candidate (@candidates){
`cd distfiles ; wget -c $candidate`;
if ($? == 0){
# Move the file to the storage
# directory
#`mv $filename distfiles`;
next download;
}
}
print "Failed to download $filename\n";
}
}
close(FILE);
This will download all the files listed in the $list file (and should also try the mirrors if the download fails) and puts them into the $PWD/distfiles folder.