freedombone-utils-login 2.8KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586
  1. #!/bin/bash
  2. #
  3. # .---. . .
  4. # | | |
  5. # |--- .--. .-. .-. .-.| .-. .--.--. |.-. .-. .--. .-.
  6. # | | (.-' (.-' ( | ( )| | | | )( )| | (.-'
  7. # ' ' --' --' -' - -' ' ' -' -' -' ' - --'
  8. #
  9. # Freedom in the Cloud
  10. #
  11. # login 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 change_login_message {
  31. if grep -Fxq "change_login_message" $COMPLETION_FILE; then
  32. return
  33. fi
  34. # remove automatic motd creator if it exists
  35. if [ -f /etc/init.d/motd ]; then
  36. rm -f /etc/init.d/motd
  37. fi
  38. echo '' > /etc/motd
  39. echo ".---. . . " >> /etc/motd
  40. echo "| | | " >> /etc/motd
  41. echo "|--- .--. .-. .-. .-.| .-. .--.--. |.-. .-. .--. .-. " >> /etc/motd
  42. echo "| | (.-' (.-' ( | ( )| | | | )( )| | (.-' " >> /etc/motd
  43. echo "' ' --' --' -' - -' ' ' -' -' -' ' - --'" >> /etc/motd
  44. if [[ $SYSTEM_TYPE == "$VARIANT_MAILBOX" ]]; then
  45. echo $' M A I L B O X E D I T I O N' >> /etc/motd
  46. fi
  47. if [[ $SYSTEM_TYPE == "$VARIANT_SOCIAL" ]]; then
  48. echo $' S O C I A L E D I T I O N' >> /etc/motd
  49. fi
  50. if [[ $SYSTEM_TYPE == "$VARIANT_CHAT" ]]; then
  51. echo $' C H A T E D I T I O N' >> /etc/motd
  52. fi
  53. if [[ $SYSTEM_TYPE == "$VARIANT_CLOUD" ]]; then
  54. echo $' C L O U D E D I T I O N' >> /etc/motd
  55. fi
  56. if [[ $SYSTEM_TYPE == "$VARIANT_WRITER" ]]; then
  57. echo $' W R I T E R E D I T I O N ' >> /etc/motd
  58. fi
  59. if [[ $SYSTEM_TYPE == "$VARIANT_MEDIA" ]]; then
  60. echo $' M E D I A E D I T I O N' >> /etc/motd
  61. fi
  62. if [[ $SYSTEM_TYPE == "$VARIANT_DEVELOPER" ]]; then
  63. echo $' D E V E L O P E R E D I T I O N' >> /etc/motd
  64. fi
  65. echo '' >> /etc/motd
  66. if [[ $SYSTEM_TYPE != "$VARIANT_MESH" ]]; then
  67. echo $' Freedom in the Cloud' >> /etc/motd
  68. else
  69. echo $' Freedom in the Mesh' >> /etc/motd
  70. fi
  71. echo '' >> /etc/motd
  72. echo 'change_login_message' >> $COMPLETION_FILE
  73. }
  74. # NOTE: deliberately no exit 0