docker 1.0 KB

1234567891011121314151617181920212223242526272829303132333435363738
  1. #!/bin/bash -ex
  2. CWD="$(cd "$(dirname "${BASH_SOURCE[0]}")" >/dev/null 2>&1 && pwd)"
  3. SOURCE_DIR=$(cd "${CWD}/.." 2> /dev/null && pwd -P)
  4. case "${1}" in
  5. before_install)
  6. if [ "${TRAVIS_OS_NAME}" = "linux" ]; then
  7. docker create \
  8. --cap-add SYS_ADMIN \
  9. --device /dev/loop-control \
  10. --name="${TRAVIS_COMMIT}" -t \
  11. -v "${SOURCE_DIR}":/tmp/build \
  12. -w /tmp/build \
  13. "${DISTRO}" /bin/cat
  14. docker start "${TRAVIS_COMMIT}"
  15. fi
  16. ;;
  17. after_script)
  18. if [ "${TRAVIS_OS_NAME}" = "linux" ]; then
  19. docker kill "${TRAVIS_COMMIT}"
  20. docker rm "${TRAVIS_COMMIT}"
  21. fi
  22. ;;
  23. *)
  24. if [ -x "${CWD}/${1}" ]; then
  25. if [ "${TRAVIS_OS_NAME}" = "linux" ]; then
  26. docker exec \
  27. "$(bash <(curl -s https://codecov.io/env))" \
  28. -e CC -e DISTRO \
  29. "${TRAVIS_COMMIT}" ./.travis/"${1}"
  30. fi
  31. fi
  32. ;;
  33. esac
  34. # vim: set ts=8 shiftwidth=4 softtabstop=4 expandtab smarttab colorcolumn=80: