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 filelistn"; } 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 $filenamen";}} 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.
[HTML_REMOVED]wget -nc -i "filename" [HTML_REMOVED] does the same as your script.(?)
Aug. 13, 2006, 12:28 a.m.
Seems like I've overlooked the -nc option back then. Thanks :-) But if I remember correctly, back then part of my motivation for writing this was also to get an excuse to play around with perl ;-)
Aug. 13, 2006, 12:51 a.m.
I've forgoten: On your system you first have to prepare the file for wget:
[HTML_REMOVED]emerge -fp "package" 2| awk -v RS=" " '{print}'[HTML_REMOVED]
Aug. 17, 2006, 8 p.m.