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.

101 lines
1.8 KiB

  1. #!/bin/bash
  2. set -eux # -x for verbose logging to juju debug-log
  3. ## 0k git remote path
  4. GIT_0K_BASE=${GIT_0K_BASE:-"0k-ro:/var/git"}
  5. ## 0k git remote options
  6. GIT_0K_CLONE_OPTIONS=${GIT_0K_CLONE_OPTIONS:-""}
  7. apt-get install -y kal-shlib-common
  8. apt-get install -y bzr
  9. mkdir -p /var/git
  10. mkdir -p /srv/git-bzr-mirrors
  11. mkdir -p /opt/apps
  12. ##
  13. ## install git-hooks
  14. ##
  15. (
  16. cd /opt/apps &&
  17. git clone "$GIT_0K_BASE"/0k/git-hooks.git &&
  18. git config --system git-hooks.install-dir /opt/apps/git-hooks &&
  19. ln -sf /opt/apps/git-hooks/bin/git-hooks /usr/lib/git-core/git-hooks
  20. )
  21. ##
  22. ## bzr-fastimport
  23. ##
  24. (
  25. cd /opt/apps &&
  26. bzr clone lp:bzr-fastimport &&
  27. mkdir /root/.bazaar/plugins -p &&
  28. ln -sf /opt/apps/bzr-fastimport /root/.bazaar/plugins/fastimport
  29. )
  30. ## This patch will correct a nasty exception documented here:
  31. ## https://bugs.launchpad.net/bzr/+bug/541626
  32. (cd /opt/apps/bzr-fastimport &&
  33. patch -p0 ) < src/patch/bzr-fastimport/btree-except.patch
  34. ##
  35. ## python-fastimport
  36. ##
  37. (
  38. cd /opt/apps &&
  39. bzr clone lp:python-fastimport &&
  40. cd python-fastimport &&
  41. python setup.py install
  42. )
  43. ##
  44. ## git-bzr-ng
  45. ##
  46. (
  47. cd /opt/apps &&
  48. git clone https://github.com/termie/git-bzr-ng.git &&
  49. ln -sf /opt/apps/git-bzr-ng/git-bzr /usr/lib/git-core/
  50. )
  51. ##
  52. ## git-bzr-syncs
  53. ##
  54. (
  55. cd /opt/apps &&
  56. git clone "$GIT_0K_BASE"/0k/git-bzr-syncs.git &&
  57. ln -sf /opt/apps/git-bzr-syncs/bin/git-bzr-syncs /usr/sbin/git-bzr-syncs
  58. )
  59. cp src/etc/cron.daily/git-bzr-syncs /etc/cron.daily/git-bzr-syncs
  60. ##
  61. ## Setup password-less access for other LXC
  62. ##
  63. LXC_USER=lxc-user
  64. LXC_USER_HOME=/var/lib/$LXC_USER
  65. groupadd -r git-users &&
  66. adduser --system --home=$LXC_USER_HOME --shell /bin/bash --ingroup=git-users $LXC_USER &&
  67. mkdir $LXC_USER_HOME/.ssh -p &&
  68. cat src/etc/ssh/lxc_git_access_id_rsa.pub >> $LXC_USER_HOME/.ssh/authorized_keys &&
  69. chown lxc-user $LXC_USER_HOME/.ssh -R