Distfiles auf andere Maschine herunterladen

Aus Gentoo Linux Wiki

Wechseln zu: Navigation, Suche
Dieser Artikel ist Teil der TIPPs & Tricks Sammlung.
Terminals / Shells X Portage System Dateisysteme Kernel Netzwerk Sonstiges alphabetischer Tipp Index

[Bearbeiten] Liste erstellen

Der folgende Befehl speichert alle Pakete die benötigt werden in die Datei /tmp/distfiles.txt.

emerge -uDp --fetchonly world 2> /tmp/distfiles.txt

[Bearbeiten] Pakete downloaden

  • Erstellen Sie folgendes Script unter /tmp/distfile-grabber auf dem Rechner, wo Sie die Dateien downloaden.

#!/usr/bin/env python

 #
 # Copyright Graham Ashton <ashtong at users dot sourceforge dot net>, 2004.
 
 
 """Download tarballs for Gentoo upgrade
 
 Downloads distfiles (i.e. the contents of /usr/portage/distfiles)
 specified by an input file. You can generate suitable input with a
 command such as this:
 
   emerge --fetchonly -uDp world 2> distfiles.txt
 
 Transfer the distfiles.txt file to a different machine, and run:
 
   distfile-grabber distfiles.txt
 
 All the files required to upgrade the first computer will be
 downloaded to a temporary directory on the second. It is intended to
 be used to download files on machines that have lots of bandwidth (and
 perhaps a CD burner), on behalf of those that don't.
 
 """
 
 
 import os
 import sys
 import tempfile
 
 
 def get_filename():
     try:
         return sys.argv[1]
     except IndexError:
         sys.stderr.write('Usage: %s <file>\n' % os.path.basename(sys.argv[0]))
         sys.exit(1)
 
 
 def download_file(urls, temp_dir):
     for url in urls.split():
         rval = os.system('wget -c -P %s %s' % (temp_dir, url))
         if rval == 0:
             break
 
 
 def main():
     filename = get_filename()
     tempfile.tempdir = '/var/tmp'
     temp_dir = tempfile.mkdtemp()
     for i, urls in enumerate(file(filename)):
         download_file(urls, temp_dir)
     print '%s files successfully downloaded to %s' % (i, temp_dir)
 
 
 if __name__ == '__main__':
     main()
  • distfile-grabber ausführbar machen

chmod a+x /tmp/distfile-grabber

  • Programmesourcen in der Datei distfiles.txt herunterladen

/tmp/distfile-grabber /tmp/distfiles.txt