freedombone-utils-final 2.1KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980
  1. #!/bin/bash
  2. #
  3. # .---. . .
  4. # | | |
  5. # |--- .--. .-. .-. .-.| .-. .--.--. |.-. .-. .--. .-.
  6. # | | (.-' (.-' ( | ( )| | | | )( )| | (.-'
  7. # ' ' --' --' -' - -' ' ' -' -' -' ' - --'
  8. #
  9. # Freedom in the Cloud
  10. #
  11. # Final stage of install
  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. OPEN_PORTS=()
  31. function install_final {
  32. if grep -Fxq "install_final" $COMPLETION_FILE; then
  33. return
  34. fi
  35. # unmount any attached usb drive
  36. if [ -d $USB_MOUNT ]; then
  37. umount $USB_MOUNT
  38. rm -rf $USB_MOUNT
  39. fi
  40. function_check split_gpg_key_into_fragments
  41. split_gpg_key_into_fragments
  42. echo 'install_final' >> $COMPLETION_FILE
  43. clear
  44. echo ''
  45. echo $"
  46. *** ${PROJECT_NAME} installation is complete. Rebooting... ***
  47. Now forward these ports from your internet router
  48. "
  49. for p in "${OPEN_PORTS[@]}"
  50. do
  51. echo " $p"
  52. done
  53. echo ''
  54. if [ -f "/home/$MY_USERNAME/README" ]; then
  55. echo $"See /home/$MY_USERNAME/README for post-installation instructions."
  56. echo ''
  57. fi
  58. # add user menu on ssh login
  59. if ! grep -q 'control' /home/$MY_USERNAME/.bashrc; then
  60. echo 'control' >> /home/$MY_USERNAME/.bashrc
  61. fi
  62. if [ ! -f $IMAGE_PASSWORD_FILE ]; then
  63. reboot
  64. fi
  65. }
  66. function setup_final {
  67. function_check install_tripwire
  68. install_tripwire
  69. function_check install_final
  70. install_final
  71. }
  72. # NOTE: deliberately no exit 0