download 514 B

1234567891011121314151617181920212223242526272829303132333435363738
  1. #!/bin/bash
  2. set -e
  3. checkit() {
  4. #checkit <sha256sum> <filename>
  5. echo "$1 $2" | sha256sum -c
  6. }
  7. if [ "$#" == 0 ]
  8. then
  9. foss=(*/)
  10. else
  11. foss=($@)
  12. fi
  13. for i in "${foss[@]}"
  14. do
  15. cd "$i"
  16. if [ -x download ]; then
  17. ./download
  18. else
  19. source ./info
  20. fn="$(basename "$url")"
  21. if ! test -f "$fn"; then
  22. rm -f *.exe *.msi
  23. fi
  24. if ! checkit "$sha256sum" "$fn"; then
  25. wget -c "$url"
  26. if ! checkit "$sha256sum" "$fn"; then
  27. rm -f "$fn"
  28. wget "$url"
  29. checkit "$sha256sum" "$fn"
  30. fi
  31. fi
  32. fi
  33. cd ..
  34. done