fork 0k-charms
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

95 lines
1.9 KiB

  1. #!/bin/bash
  2. set -ex # -x for verbose logging to juju debug-log
  3. export DEBIAN_FRONTEND=noninteractive LANG=en_US.UTF-8
  4. ##
  5. ## Code
  6. ##
  7. ## we need ssh because git needs it.
  8. DEPS="sudo"
  9. DEPS_TO_REMOVE="git"
  10. [ "$NO_SSH" ] || DEPS_TO_REMOVE="$DEPS_TO_REMOVE ssh"
  11. KEEP_ONLY_PO=${KEEP_ONLY_PO:-fr en de}
  12. apt-get install -y --force-yes --no-install-recommends \
  13. $DEPS $DEPS_TO_REMOVE
  14. ## XXXvlab: should use base-0k code instead !
  15. ## ======= BEGIN OF DUPLICATE CODE... well it has been modified =======
  16. ##
  17. ## ssh config
  18. ##
  19. ## 0k git remote path
  20. GIT_0K_BASE=${GIT_0K_BASE:-"git.0k.io:/var/git"}
  21. ## 0k git remote options
  22. GIT_0K_CLONE_OPTIONS=${GIT_0K_CLONE_OPTIONS:-""}
  23. if [ -z "$NO_SSH" ]; then
  24. cp ../base-0k/src/etc/ssh/lxc_git_access_id_rsa /etc/ssh/lxc_git_access_id_rsa
  25. chmod 0600 /etc/ssh/lxc_git_access_id_rsa
  26. mkdir -p /root/.ssh
  27. cat <<EOF > /root/.ssh/config
  28. Host git.0k.io
  29. User lxc-user
  30. IdentityFile /etc/ssh/lxc_git_access_id_rsa
  31. UserKnownHostsFile /dev/null
  32. StrictHostKeyChecking no
  33. Port 10022
  34. EOF
  35. fi
  36. ##
  37. ## install git sub
  38. ##
  39. if [ -z "$ODOO_CP_FROM_DIR" ]; then
  40. (
  41. mkdir -p /opt/apps &&
  42. cd /opt/apps &&
  43. git clone $GIT_0K_CLONE_OPTIONS "$GIT_0K_BASE"/0k/git-sub &&
  44. ln -sf /opt/apps/git-sub/bin/git-sub /usr/lib/git-core/
  45. )
  46. fi
  47. ## ===================== END OF DUPLICATE CODE ===========
  48. (cd ../0k-openerp
  49. RELEASE=jessie NO_VIRTUALENV=1 hooks/install
  50. )
  51. apt-get remove -y --force-yes $DEPS_TO_REMOVE
  52. apt-get autoremove -y
  53. rm -rf /opt/apps/git-sub /usr/lib/git-core/git-sub
  54. find /opt/apps -name .git -type d -exec rm -rf {} \; -prune
  55. if [ "$KEEP_ONLY_PO" ]; then
  56. find_args=""
  57. for lang in $KEEP_ONLY_PO; do
  58. find_args="$find_args -not -name $lang.po"
  59. done
  60. find /opt/apps -name \*.po -type f $find_args -delete
  61. fi
  62. cat <<EOF > /root/.0k-oe.rc
  63. PYTHON_BINARY=/usr/bin/python
  64. EOF