freedombone-utils-final 3.0KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101
  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@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. function install_final {
  31. if [[ $(is_completed $FUNCNAME) == "1" ]]; then
  32. return
  33. fi
  34. # unmount any attached usb drive
  35. if [ -d $USB_MOUNT ]; then
  36. umount $USB_MOUNT
  37. rm -rf $USB_MOUNT
  38. fi
  39. function_check split_gpg_key_into_fragments
  40. split_gpg_key_into_fragments
  41. set_command_file_permissions
  42. mark_completed $FUNCNAME
  43. clear
  44. echo ''
  45. echo $"
  46. *** ${PROJECT_NAME} installation is complete ***
  47. If you wish to verify the server ssh public key at next login it is:
  48. $(get_ssh_server_key)
  49. Ensure that ports are forwarded from your internet router
  50. "
  51. echo ''
  52. if [ -f "/home/$MY_USERNAME/README" ]; then
  53. echo $"See /home/$MY_USERNAME/README for post-installation instructions."
  54. echo ''
  55. fi
  56. # add user menu on ssh login
  57. if ! grep -q 'control' /home/$MY_USERNAME/.bashrc; then
  58. echo 'control' >> /home/$MY_USERNAME/.bashrc
  59. fi
  60. if [ ! -f $IMAGE_PASSWORD_FILE ]; then
  61. if [ -f /root/${PROJECT_NAME}-wifi.cfg ]; then
  62. create_wifi_startup_script
  63. echo ''
  64. echo $'Shutting down the system. Detatch the ethernet cable, attach wifi dongle, then power on again.'
  65. echo ''
  66. ${PROJECT_NAME}-logging off
  67. shutdown now
  68. return
  69. fi
  70. ${PROJECT_NAME}-logging off
  71. reboot
  72. fi
  73. ${PROJECT_NAME}-logging off
  74. }
  75. function update_installed_apps_list {
  76. # Why does this secondary file exist, apart from COMPLETION_FILE ?
  77. # It's so that it is visible to unprivileged users from the user control panel
  78. cat $COMPLETION_FILE | grep "install_" > /usr/share/${PROJECT_NAME}/installed.txt
  79. }
  80. function setup_final {
  81. function_check update_installed_apps_list
  82. update_installed_apps_list
  83. function_check install_tripwire
  84. install_tripwire
  85. function_check install_final
  86. install_final
  87. export DEBIAN_FRONTEND=
  88. }
  89. # NOTE: deliberately no exit 0