freedombone-utils-cryptopp 3.0KB

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