freedombone-app-vpn 2.0KB

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