download-extension-batch-aria2.sh 967 B

12345678910111213141516171819202122232425262728293031323334
  1. #!/bin/bash
  2. set -exu
  3. __DIR__=$(
  4. cd "$(dirname "$0")"
  5. pwd
  6. )
  7. cd ${__DIR__}
  8. # https://aria2.github.io/manual/en/html/aria2c.html#http-ftp-segmented-downloads
  9. # https://aria2.github.io/manual/en/html/aria2c.html
  10. # -with-config-file-path=/usr/local/php/etc
  11. # -U, --user-agent
  12. # aria2c -h
  13. # aria2c --conf-path=/etc/aria2/aria2.conf
  14. :<<EOF
  15. -c, --continue [true|false]
  16. -s, --split=<N>
  17. -x, --max-connection-per-server=<NUM>
  18. -k, --min-split-size=<SIZE>
  19. -j, --max-concurrent-downloads=<N>
  20. -i, --input-file=<FILE>
  21. EOF
  22. user_agent='Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/109.0.0.0 Safari/537.36'
  23. test -f download_extension_urls.txt && aria2c -c -j 10 -s 10 -x 8 -k 10M --allow-overwrite=true --max-tries=30 --retry-wait=15 --user-agent=$user_agent \
  24. -d extensions --input-file=download_extension_urls.txt
  25. mkdir -p source/extensions
  26. awk 'BEGIN { cmd="cp -ri extensions/* source/extensions/" ; print "n" |cmd; }'