freedombone-utils-filesystem 2.4KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394
  1. #!/bin/bash
  2. #
  3. # .---. . .
  4. # | | |
  5. # |--- .--. .-. .-. .-.| .-. .--.--. |.-. .-. .--. .-.
  6. # | | (.-' (.-' ( | ( )| | | | )( )| | (.-'
  7. # ' ' --' --' -' - -' ' ' -' -' -' ' - --'
  8. #
  9. # Freedom in the Cloud
  10. #
  11. # Filesystem encryption, etc
  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. TOMB_REPO="https://github.com/dyne/Tomb"
  31. TOMB_COMMIT='c80ebd6d6ed77980eb5b559757e03ea13a29bdd1'
  32. function mesh_install_tomb {
  33. chroot ${rootdir} apt-get -y install cryptsetup zsh pinentry-curses
  34. if [ ! -d ${rootdir}/$INSTALL_DIR ]; then
  35. mkdir -p ${rootdir}/$INSTALL_DIR
  36. fi
  37. git_clone $TOMB_REPO ${rootdir}/$INSTALL_DIR/tomb
  38. cd ${rootdir}/$INSTALL_DIR/tomb
  39. git checkout $TOMB_COMMIT -b $TOMB_COMMIT
  40. chroot ${rootdir} /bin/bash -x <<EOF
  41. cd $INSTALL_DIR/tomb
  42. make install
  43. EOF
  44. if [ ! -f ${rootdir}/usr/local/bin/tomb ]; then
  45. exit 93462
  46. fi
  47. }
  48. function install_tomb {
  49. if [ $INSTALLING_MESH ]; then
  50. mesh_install_tomb
  51. return
  52. fi
  53. function_check set_repo_commit
  54. set_repo_commit $INSTALL_DIR/tomb "Tomb commit" "$TOMB_COMMIT" $TOMB_REPO
  55. if [ -f $COMPLETION_FILE ]; then
  56. if grep -Fxq "install_tomb" $COMPLETION_FILE; then
  57. return
  58. fi
  59. fi
  60. apt-get -y install cryptsetup zsh pinentry-curses
  61. if [ ! -d $INSTALL_DIR ]; then
  62. mkdir -p $INSTALL_DIR
  63. fi
  64. git_clone $TOMB_REPO $INSTALL_DIR/tomb
  65. cd $INSTALL_DIR/tomb
  66. git checkout $TOMB_COMMIT -b $TOMB_COMMIT
  67. if ! grep -q "Tomb commit" $COMPLETION_FILE; then
  68. echo "Tomb commit:$TOMB_COMMIT" >> $COMPLETION_FILE
  69. else
  70. sed -i "s/Tomb commit.*/Tomb commit:$TOMB_COMMIT/g" $COMPLETION_FILE
  71. fi
  72. make install
  73. if [ ! -f /usr/local/bin/tomb ]; then
  74. exit 93462
  75. fi
  76. echo 'install_tomb' >> $COMPLETION_FILE
  77. }
  78. # NOTE: deliberately no exit 0