freedombone-utils-i2p 2.5KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576
  1. #!/bin/bash
  2. #
  3. # .---. . .
  4. # | | |
  5. # |--- .--. .-. .-. .-.| .-. .--.--. |.-. .-. .--. .-.
  6. # | | (.-' (.-' ( | ( )| | | | )( )| | (.-'
  7. # ' ' --' --' -' - -' ' ' -' -' -' ' - --'
  8. #
  9. # Freedom in the Cloud
  10. #
  11. # i2p functions
  12. #
  13. # There's a problem with installing this onto mesh images, which is
  14. # that qemu appears to run out of RAM when using yarn to add webpack.
  15. #
  16. # License
  17. # =======
  18. #
  19. # Copyright (C) 2017-2018 Bob Mottram <bob@freedombone.net>
  20. #
  21. # This program is free software: you can redistribute it and/or modify
  22. # it under the terms of the GNU Affero General Public License as published by
  23. # the Free Software Foundation, either version 3 of the License, or
  24. # (at your option) any later version.
  25. #
  26. # This program is distributed in the hope that it will be useful,
  27. # but WITHOUT ANY WARRANTY; without even the implied warranty of
  28. # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  29. # GNU Affero General Public License for more details.
  30. #
  31. # You should have received a copy of the GNU Affero General Public License
  32. # along with this program. If not, see <http://www.gnu.org/licenses/>.
  33. I2P_DOMAIN='deb.i2p2.de'
  34. function install_i2p {
  35. if [ ! -d $INSTALL_DIR ]; then
  36. mkdir -p $INSTALL_DIR
  37. fi
  38. # install the gpg key
  39. cd $INSTALL_DIR
  40. if [ -f i2p-debian-repo.key.asc ]; then
  41. rm i2p-debian-repo.key.asc
  42. fi
  43. wget https://geti2p.net/_static/i2p-debian-repo.key.asc
  44. if [ ! -f i2p-debian-repo.key.asc ]; then
  45. echo $'failed to ontain i2p repo gpg key'
  46. exit 7834627345
  47. fi
  48. apt-key add i2p-debian-repo.key.asc
  49. echo "deb https://${I2P_DOMAIN}/ stretch main" > /etc/apt/sources.list.d/i2p.list
  50. echo "deb-src https://${I2P_DOMAIN}/ stretch main" >> /etc/apt/sources.list.d/i2p.list
  51. # i2p needs ipv6 to be enabled
  52. sed -i 's|net.ipv6.conf.all.disable_ipv6.*|net.ipv6.conf.all.disable_ipv6 = 0|g' /etc/sysctl.conf
  53. /sbin/sysctl -p -q
  54. apt-get update
  55. apt-get -yq install i2p i2p-keyring
  56. }
  57. function remove_i2p {
  58. apt-get -yq remove i2p i2p-keyring --purge
  59. # It's assumed here that ipv6 is only needed for i2p
  60. # This might not be true in future
  61. sed -i 's|net.ipv6.conf.all.disable_ipv6.*|net.ipv6.conf.all.disable_ipv6 = 1|g' /etc/sysctl.conf
  62. /sbin/sysctl -p -q
  63. }
  64. function i2p_enable_sam {
  65. sed -i 's|clientApp.1.startOnLoad=.*|clientApp.1.startOnLoad=true|g' /var/lib/i2p/i2p-config/clients.config
  66. systemctl restart i2p
  67. }