The old Debian source synchronization script Debian Lenny source is officially archived, making many servers that cannot update the system unavailable. archive.debian.org is too slow to access and cannot write a script to synchronize lenny source. Due to the structure of the Debian source, it is inconvenient to synchronize the versions separately. The packages are concentrated in the/pool directory, therefore, the script generates the package list of this version based on the index file. ARCH_EXCLUDE is used to filter the packages of different architectures. dists is used to filter the entire lenny source (i386, amd64, source) total 50 Glenny archive source set deb http://mirrors.163.com/debian-archive/ lenny main contrib non-freedeb-src http://mirrors.163.com/debian-archive/ lenny main contrib non-free synchronization script code #! /Bin/sh # author: igi # date: 2012-03-28 TO = "/tmp/debian" FROM = "archive.debian.org: debian-archive/debian" # FROM = "debian. ethz. ch: debian-archive/debian "# FROM =" 2.16.1und1.de: debian-archive/debian "# FROM =" debian. koyanet. lv :: debian-archive/debian "RUNDIR ="/tmp/"ARCH_EXCLUDE =" alpha arm armel armhf hppa hurd-i386 ia64 kfreebsd-amd64 kfreebsd-i386 mips mipsel powerpc s390 s390x "for ARCH in $ ARCH_EXCLUDE; do EXCLUDE = $ EXCLUDE "\ -- exclude binary-$ ARCH/\ -- exclude * _ $ ARCH. deb \ -- exclude * _ $ ARCH. udeb \ -- exclude installer-$ ARCH/\ -- exclude Contents-$ ARCH * "done # dists = 'lenny etch' dists = 'lenny 'for dist in $ dists; do DIST_INCLUDE =$ {DIST_INCLUDE} "\ -- include/dists/$ dist/contrib/\ -- include/dists/$ dist/main /\ -- include/dists/$ dist/non-free/"DIST_EXCLUDE =" $ {DIST_EXCLUDE} \ -- exclude/dists/$ dist/* "done # sync index filesrsync -- progress-av \ -- include 'Packages.gz '\ -- include 'Sources.gz' \ $ DIST_INCLUDE \ -- include '/dists/' \ -- exclude '/*' \ -- exclude '/dists/*' \ $ DIST_EXCLUDE \ -- exclude 'i18n' \ -- exclude 'installer-amd64' \ -- exclude 'installer-i386' \ -- exclude 'release' \ -- exclude '*. bz2 '\ $ EXCLUDE \ "$ FROM/" "$ TO/" find "$ TO/dists/"-name 'Packages.gz'-exec zgrep 'Filename: '{}+ | awk' {print $2}'> "$ RUNDIR"/filelistfind "$ TO/dists/"-name 'Sources.gz '-exec zcat {}+ | awk' /Directory: /{dir = $2; next};/Files:/{files = 1; next}; files &/^/{print dir "/" $ NF }; /^ [^]/{files = 0; next} '> "$ RUNDIR"/filelist # first stagersync -- progress-v -- recursive -- times -- links -- hard-links \ -- files-from = "$ RUNDIR"/filelist \ "$ FROM/" "$ TO/" # second stagersync -- progress-v -- recursive -- times -- links -- hard-links \ $ DIST_INCLUDE \ -- exclude '/dists /*' \ $ EXCLUDE \ -- exclude '/pool/' \ "$ FROM/" "$ /"