package-upload.sh 797 B

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. #!/bin/sh
  2. set -e
  3. user="netdatabot"
  4. host="${1}"
  5. distro="${2}"
  6. arch="${3}"
  7. format="${4}"
  8. repo="${5}"
  9. pkg_src="${6:-./artifacts}"
  10. staging="${TMPDIR:-/tmp}/package-staging"
  11. prefix="/home/netdatabot/incoming/${repo}/"
  12. packages="$(find "${pkg_src}" -name "*.${format}")"
  13. mkdir -p "${staging}"
  14. case "${format}" in
  15. deb)
  16. src="${staging}/${distro}"
  17. mkdir -p "${src}"
  18. for pkg in ${packages}; do
  19. cp "${pkg}" "${src}"
  20. done
  21. ;;
  22. rpm)
  23. src="${staging}/${distro}/${arch}/"
  24. mkdir -p "${src}"
  25. for pkg in ${packages}; do
  26. cp "${pkg}" "${src}"
  27. done
  28. ;;
  29. *)
  30. echo "Unrecognized package format ${format}."
  31. exit 1
  32. ;;
  33. esac
  34. rsync -vrptO "${staging}/" "${user}@${host}:${prefix}"