build.sh 1.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. #!/bin/bash
  2. # Install required packages
  3. if [ "$1" != '--non-interactive' ]; then
  4. ./resources/install_dependencies.sh
  5. fi
  6. # Create the Makefile using cmake, from a clean build directory
  7. cd code_boost/src/build/
  8. if [ ${PWD##*/} = 'build' ]; then
  9. # Only delete everything if we are in a folder called 'build'.
  10. rm -rf ./*
  11. else
  12. echo "Error: The 'build' directory was not found."
  13. exit
  14. fi
  15. cmake ..
  16. if [ -f Makefile ]; then
  17. make
  18. else
  19. echo "Error: 'cmake' did not finish successfully."
  20. exit
  21. fi
  22. if [ $? -eq 0 ]; then
  23. cp libpcapreader.so ../../../code/ID2TLib/
  24. else
  25. echo "Error: 'make' did not finish successfully."
  26. exit
  27. fi
  28. cd ../../../
  29. # Create the ID2T script
  30. cat >./id2t <<EOF
  31. #!/bin/sh
  32. # Find the executable
  33. if [ $(uname) = 'Darwin' ]; then
  34. alias readlink='greadlink'
  35. fi
  36. ID2T_DIR=\$(readlink -f \$0)
  37. SCRIPT_PATH=\${ID2T_DIR%/*}
  38. cd \$SCRIPT_PATH
  39. # Execute ID2T
  40. exec ./code/CLI.py "\$@"
  41. EOF
  42. chmod +x ./code/CLI.py
  43. chmod +x ./id2t
  44. echo -e "\n\nAll is set. ID2T is ready."
  45. echo -e "\nRun ID2T with the command './id2t'"