bundle.sh 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849
  1. #! /usr/bin/env bash
  2. #
  3. # This script will bundle libhtp and/or suricata-update for you.
  4. #
  5. # To use, run from the top Suricata source directory:
  6. #
  7. # ./scripts/bundle.sh
  8. what="$1"
  9. while IFS= read -r requirement; do
  10. set -- $requirement
  11. # If a requirement was specified on the command line, skip all other
  12. # requirements.
  13. if [ "${what}" != "" ]; then
  14. if [ "${what}" != "$1" ]; then
  15. continue
  16. fi
  17. fi
  18. case "$1" in
  19. suricata-update)
  20. repo=${SU_REPO:-$2}
  21. branch=${SU_BRANCH:-$3}
  22. echo "===> Bundling ${repo} -b ${branch}"
  23. rm -rf suricata-update.tmp
  24. git clone "${repo}" -b "${branch}" suricata-update.tmp
  25. cp -a suricata-update.tmp/* suricata-update/
  26. rm -rf suricata-update.tmp
  27. ;;
  28. libhtp)
  29. repo=${LIBHTP_REPO:-$2}
  30. branch=${LIBHTP_BRANCH:-$3}
  31. echo "===> Bundling ${repo} -b ${branch}"
  32. rm -rf libhtp
  33. git clone "${repo}" -b "${branch}" libhtp
  34. ;;
  35. \#*)
  36. # Ignore comment.
  37. ;;
  38. "")
  39. # Ignore blank line.
  40. ;;
  41. *)
  42. echo "error: unknown requirement: $1"
  43. ;;
  44. esac
  45. done < ./requirements.txt