build.sh 932 B

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