test-install-script 979 B

12345678910111213141516171819202122232425262728293031
  1. #!/bin/bash
  2. # This script is used for testing install.sh and that it works for
  3. # each of component of our apt and yum repos
  4. set -e
  5. test_install_script(){
  6. # these are equivalent to main, testing, experimental components
  7. # in the repos, but its the url that will do the conversion
  8. components=( experimental test get )
  9. for component in "${components[@]}"; do
  10. # change url to specific component for testing
  11. local test_url=https://${component}.docker.com
  12. local script=$(mktemp /tmp/install-XXXXXXXXXX.sh)
  13. sed "s,url='https://get.docker.com/',url='${test_url}/'," hack/install.sh > "${script}"
  14. chmod +x "${script}"
  15. # test for each Dockerfile in contrib/builder
  16. for dir in contrib/builder/*/*/; do
  17. local from="$(awk 'toupper($1) == "FROM" { print $2; exit }' "$dir/Dockerfile")"
  18. echo "running install.sh for ${component} with ${from}"
  19. docker run --rm -i -v ${script}:/install.sh ${from} /install.sh
  20. done
  21. rm -f ${script}
  22. done
  23. }
  24. test_install_script