|
如今编译firefox-pgo不觉得编译速度慢, 倒是觉得下载速度慢的很囧...
不知道大家是怎么解决这个问题的?
我写了一个脚本, 利用aria2从不同的镜像一起多线程下载, 速度达到500K以上. 于是贴上来给大家分享:
- #!/bin/bash
- # For your crappy internet connection. Thanks to Gentoo mirrors; thanks to Google.
- pkgver=3.6.13
- filename=firefox-${pkgver}.source.tar.bz2
- hashsum='4b90775c0f29cb7e170a80894311d8c7a2cd794c50e2124b70d1b83011c45f63'
- hashtype=sha256
- uris=()
- mozilla_mirrors=(
- 'ftp://ftp.mozilla.org'
- 'http://releases.mozilla.org'
- 'http://releases.mozillaonline.com'
- 'http://pv-mirror01.mozilla.org'
- 'http://mozilla.cs.utah.edu'
- 'http://mozilla.isc.org'
- 'http://mozilla.ntua.gr'
- 'http://mozilla.sakura.ad.jp'
- 'http://mirror.its.uidaho.edu'
- 'http://www.mirrorservice.org/sites/ftp.mozilla.org'
- 'http://kyoto-mz-dl.sinet.ad.jp'
- )
- for m in "${mozilla_mirrors[@]}"; do
- uris+=(${m%/}/pub/mozilla.org/firefox/releases/${pkgver}/source/${filename})
- done
- gentoo_mirrors=(
- 'http://gentoo.aditsu.net:8000'
- 'http://distfiles.gentoo.bg'
- 'http://gentoo.channelx.biz'
- 'http://mirror.mcs.anl.gov/pub/gentoo'
- 'http://gentoo.c3sl.ufpr.br'
- 'http://gentoo.cs.uni.edu'
- 'http://gentoo.arcticnetwork.ca'
- 'http://gentoo.mirrors.tera-byte.com'
- 'http://darkstar.ist.utl.pt/gentoo'
- )
- for m in "${gentoo_mirrors[@]}"; do
- uris+=(${m%/}/distfiles/${filename})
- done
- metalink='<?xml version="1.0" encoding="utf-8"?>'
- metalink+=$'\n''<metalink version="3.0" xmlns="http://www.metalinker.org/">'
- metalink+=$'\n''<files>'
- metalink+=$'\n'" <file name="${filename}">"
- metalink+=$'\n'" <verification>"
- metalink+=$'\n'" <hash type="${hashtype}">${hashsum}</hash>"
- metalink+=$'\n'" </verification>"
- metalink+=$'\n'" <resources>"
- for uri in "${uris[@]}"; do
- urltype=${uri%%://*}
- metalink+=$'\n'" <url type="${urltype}">${uri}</url>"
- done
- metalink+=$'\n'" </resources>"
- metalink+=$'\n'" </file>"
- metalink+=$'\n''</files>'
- metalink+=$'\n''</metalink>'
- echo "${metalink}" | aria2c --metalink-file=- --metalink-servers=20 --min-split-size=1M
复制代码 |
|