freedombone-utils-cryptopp 3.1KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102
  1. #!/bin/bash
  2. #
  3. # .---. . .
  4. # | | |
  5. # |--- .--. .-. .-. .-.| .-. .--.--. |.-. .-. .--. .-.
  6. # | | (.-' (.-' ( | ( )| | | | )( )| | (.-'
  7. # ' ' --' --' -' - -' ' ' -' -' -' ' - --'
  8. #
  9. # Freedom in the Cloud
  10. #
  11. # A recent version of crypto++ is needed by some things
  12. #
  13. # License
  14. # =======
  15. #
  16. # Copyright (C) 2014-2018 Bob Mottram <bob@freedombone.net>
  17. #
  18. # This program is free software: you can redistribute it and/or modify
  19. # it under the terms of the GNU Affero General Public License as published by
  20. # the Free Software Foundation, either version 3 of the License, or
  21. # (at your option) any later version.
  22. #
  23. # This program is distributed in the hope that it will be useful,
  24. # but WITHOUT ANY WARRANTY; without even the implied warranty of
  25. # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  26. # GNU Affero General Public License for more details.
  27. #
  28. # You should have received a copy of the GNU Affero General Public License
  29. # along with this program. If not, see <http://www.gnu.org/licenses/>.
  30. CRYPTOPP_REPO="https://github.com/weidai11/cryptopp"
  31. CRYPTOPP_COMMIT='65e91a8caa8c1846cb311bc83d8507e12699d6d3'
  32. function mesh_install_cryptopp {
  33. # shellcheck disable=SC2154
  34. if [ ! -d "$rootdir$INSTALL_DIR" ]; then
  35. chroot "$rootdir" mkdir -p "$INSTALL_DIR"
  36. fi
  37. chroot "$rootdir" apt-get -yq install build-essential
  38. git clone "$CRYPTOPP_REPO" "$rootdir$INSTALL_DIR/cryptopp"
  39. cd "$rootdir$INSTALL_DIR/cryptopp" || exit 346873625
  40. git checkout $CRYPTOPP_COMMIT -b $CRYPTOPP_COMMIT
  41. mkdir "$rootdir$INSTALL_DIR/cryptopp/build"
  42. cat <<EOF > "$rootdir/root/install_cryptopp"
  43. cd $INSTALL_DIR/cryptopp/build
  44. cmake ..
  45. if ! make; then
  46. exit 62825
  47. fi
  48. make install
  49. EOF
  50. chroot "$rootdir" chmod +x /root/install_cryptopp
  51. chroot "$rootdir" /root/install_cryptopp
  52. chroot "$rootdir" rm /root/install_cryptopp
  53. }
  54. function install_cryptopp {
  55. if [ "$INSTALLING_MESH" ]; then
  56. mesh_install_cryptopp
  57. return
  58. fi
  59. if [ -d "$INSTALL_DIR/cryptopp" ]; then
  60. if ! grep -q "Crypto++ commit:$CRYPTOPP_COMMIT" "$COMPLETION_FILE"; then
  61. set_repo_commit "$INSTALL_DIR/cryptopp" "Crypto++ commit" "$CRYPTOPP_COMMIT" "$CRYPTOPP_REPO"
  62. cd "$INSTALL_DIR/cryptopp/build" || exit 27482468
  63. cmake ..
  64. if ! make; then
  65. exit 72581
  66. fi
  67. make install
  68. fi
  69. fi
  70. if [[ $(is_completed "${FUNCNAME[0]}") == "1" ]]; then
  71. return
  72. fi
  73. if [ ! -d "$INSTALL_DIR" ]; then
  74. mkdir -p "$INSTALL_DIR"
  75. fi
  76. apt-get -yq install build-essential
  77. git_clone "$CRYPTOPP_REPO" "$INSTALL_DIR/cryptopp"
  78. cd "$INSTALL_DIR/cryptopp" || exit 257478246
  79. git checkout $CRYPTOPP_COMMIT -b $CRYPTOPP_COMMIT
  80. mkdir -p "$INSTALL_DIR/cryptopp/build"
  81. cd "$INSTALL_DIR/cryptopp/build" || exit 6275425427
  82. cmake ..
  83. if ! make; then
  84. exit 62826
  85. fi
  86. make install
  87. mark_completed "${FUNCNAME[0]}"
  88. }
  89. # NOTE: deliberately there is no "exit 0"