freedombone-upgrade 2.2KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182
  1. #!/bin/bash
  2. #
  3. # .---. . .
  4. # | | |
  5. # |--- .--. .-. .-. .-.| .-. .--.--. |.-. .-. .--. .-.
  6. # | | (.-' (.-' ( | ( )| | | | )( )| | (.-'
  7. # ' ' --' --' -' - -' ' ' -' -' -' ' - --'
  8. #
  9. # Freedom in the Cloud
  10. #
  11. # Command to upgrade the system
  12. # License
  13. # =======
  14. #
  15. # Copyright (C) 2015-2016 Bob Mottram <bob@freedombone.net>
  16. #
  17. # This program is free software: you can redistribute it and/or modify
  18. # it under the terms of the GNU Affero General Public License as published by
  19. # the Free Software Foundation, either version 3 of the License, or
  20. # (at your option) any later version.
  21. #
  22. # This program is distributed in the hope that it will be useful,
  23. # but WITHOUT ANY WARRANTY; without even the implied warranty of
  24. # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  25. # GNU Affero General Public License for more details.
  26. #
  27. # You should have received a copy of the GNU Affero General Public License
  28. # along with this program. If not, see <http://www.gnu.org/licenses/>.
  29. PROJECT_NAME='freedombone'
  30. PROJECT_DIR="$HOME/${PROJECT_NAME}"
  31. # An optional configuration file which overrides some of these variables
  32. CONFIGURATION_FILE="$HOME/${PROJECT_NAME}.cfg"
  33. PROJECT_REPO="https://github.com/bashrc/${PROJECT_NAME}"
  34. FRIENDS_MIRRORS_SERVER=
  35. FRIENDS_MIRRORS_SSH_PORT=2222
  36. FRIENDS_MIRRORS_PASSWORD=
  37. MY_MIRRORS_PASSWORD=
  38. UTILS_FILES=/usr/share/${PROJECT_NAME}/utils/${PROJECT_NAME}-utils-*
  39. for f in $UTILS_FILES
  40. do
  41. source $f
  42. done
  43. read_config_param PROJECT_REPO
  44. update-ca-certificates
  45. read_repo_servers
  46. ${PROJECT_NAME}-mirrors
  47. if [ ! -d $PROJECT_DIR ]; then
  48. # TODO after stockholm merge change this to git_clone
  49. git clone $PROJECT_REPO $PROJECT_DIR
  50. fi
  51. if [ -d $PROJECT_DIR ]; then
  52. if [ -f $CONFIGURATION_FILE ]; then
  53. cd $PROJECT_DIR
  54. rm -rf $PROJECT_DIR/locale/*
  55. git checkout stockholm
  56. # TODO after stockholm merge change this to git_pull
  57. git merge --abort
  58. git stash
  59. git pull $PROJECT_REPO
  60. make install
  61. ${PROJECT_NAME} -c $CONFIGURATION_FILE
  62. fi
  63. fi
  64. if [ -f /usr/bin/reset-tripwire ]; then
  65. echo '
  66. ' | reset-tripwire
  67. fi
  68. # deliberately there is no 'exit 0' here