freedombone-app-vpn 2.2KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586
  1. #!/bin/bash
  2. #
  3. # .---. . .
  4. # | | |
  5. # |--- .--. .-. .-. .-.| .-. .--.--. |.-. .-. .--. .-.
  6. # | | (.-' (.-' ( | ( )| | | | )( )| | (.-'
  7. # ' ' --' --' -' - -' ' ' -' -' -' ' - --'
  8. #
  9. # Freedom in the Cloud
  10. #
  11. # VPN 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. VARIANTS=''
  31. function change_password_vpn {
  32. echo -n ''
  33. }
  34. function reconfigure_vpn {
  35. echo -n ''
  36. }
  37. function upgrade_vpn {
  38. echo -n ''
  39. }
  40. function backup_local_vpn {
  41. echo -n ''
  42. }
  43. function restore_local_vpn {
  44. echo -n ''
  45. }
  46. function backup_remote_vpn {
  47. echo -n ''
  48. }
  49. function restore_remote_vpn {
  50. echo -n ''
  51. }
  52. function remove_vpn {
  53. apt-get -y remove --purge fastd
  54. sed -i '/install_vpn/d' $COMPLETION_FILE
  55. }
  56. function install_vpn {
  57. if grep -Fxq "install_vpn" $COMPLETION_FILE; then
  58. return
  59. fi
  60. if ! grep -q "repo.universe-factory.net" /etc/apt/sources.list; then
  61. echo 'deb http://repo.universe-factory.net/debian/ sid main' >> /etc/apt/sources.list
  62. gpg --keyserver pgpkeys.mit.edu --recv-key 16EF3F64CB201D9C
  63. if [ ! "$?" = "0" ]; then
  64. exit 76272
  65. fi
  66. gpg -a --export 16EF3F64CB201D9C | sudo apt-key add -
  67. apt-get update
  68. apt-get -y install fastd
  69. if [ ! "$?" = "0" ]; then
  70. exit 52026
  71. fi
  72. fi
  73. echo 'install_vpn' >> $COMPLETION_FILE
  74. }
  75. # NOTE: deliberately there is no "exit 0"