download 1.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. #!/bin/bash
  2. # download script: Download the programmes used in libreboot, that
  3. # aren't distributed in the git repository.
  4. #
  5. # Copyright (C) 2014, 2015 Francis Rowe <info@gluglug.org.uk>
  6. #
  7. # This program is free software: you can redistribute it and/or modify
  8. # it under the terms of the GNU General Public License as published by
  9. # the Free Software Foundation, either version 3 of the License, or
  10. # (at your option) any later version.
  11. #
  12. # This program is distributed in the hope that it will be useful,
  13. # but WITHOUT ANY WARRANTY; without even the implied warranty of
  14. # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  15. # GNU General Public License for more details.
  16. #
  17. # You should have received a copy of the GNU General Public License
  18. # along with this program. If not, see <http://www.gnu.org/licenses/>.
  19. #
  20. [ "x${DEBUG+set}" = 'xset' ] && set -v
  21. set -u -e
  22. download="./resources/scripts/helpers/download"
  23. programme="unknown"
  24. usage="./download programme"
  25. availableprogrammes="$(ls ${download}/)"
  26. # User specified no or too few/many parameters
  27. if (( $# != 1 )); then
  28. printf "%s\n\n" "${usage}"
  29. printf "possible values for 'programme':\nall:\n%s\n\n" "${availableprogrammes}"
  30. printf "Example (download everything): ./download all\n"
  31. printf "Example (download coreboot): ./download coreboot\n\n"
  32. exit 1
  33. fi
  34. programme="${1}"
  35. if [ "${programme}" = "all" ]; then
  36. for programme in ${availableprogrammes}; do
  37. ${download}/${programme}
  38. done
  39. elif [ -f "${download}/${programme}" ]; then
  40. ${download}/${programme}
  41. else
  42. printf "Invalid programme. Available programmes are:\nall\n%s\n" "${availableprogrammes}"
  43. exit 1
  44. fi
  45. # ------------------- DONE ----------------------