freedombone-utils-interactive 3.3KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109
  1. #!/bin/bash
  2. #
  3. # .---. . .
  4. # | | |
  5. # |--- .--. .-. .-. .-.| .-. .--.--. |.-. .-. .--. .-.
  6. # | | (.-' (.-' ( | ( )| | | | )( )| | (.-'
  7. # ' ' --' --' -' - -' ' ' -' -' -' ' - --'
  8. #
  9. # Freedom in the Cloud
  10. #
  11. # Interactive install functions
  12. #
  13. # License
  14. # =======
  15. #
  16. # Copyright (C) 2014-2016 Bob Mottram <bob@robotics.uk.to>
  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. function interactive_configuration_remote_backups {
  31. if [[ $SYSTEM_TYPE == "$VARIANT_MESH" ]]; then
  32. return
  33. fi
  34. if [ ! -f /usr/local/bin/${PROJECT_NAME}-remote ]; then
  35. if [ ! -f /usr/bin/${PROJECT_NAME}-remote ]; then
  36. echo $"The command ${PROJECT_NAME}-remote was not found"
  37. exit 87354
  38. fi
  39. fi
  40. ${PROJECT_NAME}-remote -u $MY_USERNAME -l $FRIENDS_SERVERS_LIST -m $MINIMUM_PASSWORD_LENGTH -r yes
  41. if [ ! "$?" = "0" ]; then
  42. echo $'Command failed:'
  43. echo ''
  44. echo $" ${PROJECT_NAME}-remote -u $MY_USERNAME -l $FRIENDS_SERVERS_LIST -m $MINIMUM_PASSWORD_LENGTH -r yes"
  45. echo ''
  46. exit 65892
  47. fi
  48. }
  49. function interactive_configuration {
  50. if [ ! -f /usr/local/bin/${PROJECT_NAME}-config ]; then
  51. if [ ! -f /usr/bin/${PROJECT_NAME}-config ]; then
  52. echo $"The command ${PROJECT_NAME}-config was not found"
  53. exit 63935
  54. fi
  55. fi
  56. if [ -f /tmp/meshuserdevice ]; then
  57. rm -f /tmp/meshuserdevice
  58. fi
  59. if [[ $ONION_ONLY == "no" ]]; then
  60. if [[ $MINIMAL_INSTALL == "no" ]]; then
  61. ${PROJECT_NAME}-config \
  62. -f $CONFIGURATION_FILE \
  63. -w $PROJECT_WEBSITE \
  64. -m $MINIMUM_PASSWORD_LENGTH
  65. else
  66. ${PROJECT_NAME}-config \
  67. -f $CONFIGURATION_FILE \
  68. -w $PROJECT_WEBSITE \
  69. -m $MINIMUM_PASSWORD_LENGTH \
  70. --minimal "yes"
  71. fi
  72. else
  73. ${PROJECT_NAME}-config \
  74. -f $CONFIGURATION_FILE \
  75. -w $PROJECT_WEBSITE \
  76. -m $MINIMUM_PASSWORD_LENGTH \
  77. --onion "yes"
  78. fi
  79. if [ -f /tmp/meshuserdevice ]; then
  80. # mesh network user device installation
  81. rm -f /tmp/meshuserdevice
  82. exit 0
  83. fi
  84. if [ ! "$?" = "0" ]; then
  85. echo $'Command failed:'
  86. echo ''
  87. echo $" ${PROJECT_NAME}-config -u $MY_USERNAME -f $CONFIGURATION_FILE -w $PROJECT_WEBSITE -b $PROJECT_BITMESSAGE -m $MINIMUM_PASSWORD_LENGTH --minimal [yes|no]"
  88. echo ''
  89. exit 73594
  90. fi
  91. if [[ $SYSTEM_TYPE == "$VARIANT_MESH" ]]; then
  92. FRIENDS_SERVERS_LIST=/home/$MY_USERNAME/backup.list
  93. dialog --title $"Encrypted backup to other servers" \
  94. --backtitle $"${PROJECT_NAME} Configuration" \
  95. --defaultno \
  96. --yesno $"\nDo you wish to configure some remote backup locations?" 7 60
  97. sel=$?
  98. case $sel in
  99. 0) interactive_configuration_remote_backups;;
  100. esac
  101. fi
  102. }
  103. # NOTE: deliberately no exit 0