build.sh 953 B

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  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. else
  21. echo "Error: 'make' did not finish successfully."
  22. exit
  23. fi
  24. cd ../../../
  25. # Create the ID2T script
  26. cat >./id2t <<EOF
  27. #!/bin/sh
  28. # Find the executable
  29. if [ $(uname) == 'Darwin' ]; then
  30. alias readlink='greadlink'
  31. fi
  32. ID2T_DIR=\$(readlink -f \$0)
  33. SCRIPT_PATH=\${ID2T_DIR%/*}
  34. cd \$SCRIPT_PATH
  35. # Execute ID2T
  36. exec ./code/CLI.py "\$@"
  37. EOF
  38. chmod +x ./code/CLI.py
  39. chmod +x ./id2t
  40. echo -e "\n\nAll is set. ID2T is ready."
  41. echo -e "\nRun ID2T with the command './id2t'"