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.

69 lines
1.7 KiB

  1. #!/bin/bash
  2. ## 0k git remote path
  3. GIT_0K_BASE=${GIT_0K_BASE:-"0k-ro:/var/git"}
  4. ## 0k git remote options
  5. GIT_0K_CLONE_OPTIONS=${GIT_0K_CLONE_OPTIONS:-""}
  6. ##
  7. ## Install 0k-manage
  8. ##
  9. mkdir -p /opt/apps
  10. (
  11. if ! [ -d "/opt/apps/0k-manage" ]; then
  12. cd /opt/apps &&
  13. git clone $GIT_0K_CLONE_OPTIONS "$GIT_0K_BASE/0k/0k-manage.git" &&
  14. cd /opt/apps/0k-manage &&
  15. git checkout 0k/prod/master
  16. fi
  17. )
  18. ##
  19. ## Install 0k-charms
  20. ##
  21. (
  22. if ! [ -d "/opt/apps/0k-charms" ]; then
  23. cd /opt/apps &&
  24. git clone $GIT_0K_CLONE_OPTIONS "$GIT_0K_BASE/0k/0k-charms.git" &&
  25. cd /opt/apps/0k-charms &&
  26. git checkout master
  27. fi
  28. if ! [ -d "/srv/charm-store" ]; then
  29. mkdir -p /srv/charm-store &&
  30. find /opt/apps/0k-charms -type d -exec /usr/bin/test -e {}/metadata.yml \
  31. -o -e {}/metadata.yaml \; -print | while read f; do
  32. ln -sf "$f" /srv/charm-store/
  33. done
  34. fi
  35. )
  36. ##
  37. ## Install lxc-scripts
  38. ##
  39. (
  40. if ! [ -d "/opt/apps/lxc-scripts" ]; then
  41. cd /opt/apps &&
  42. git clone $GIT_0K_CLONE_OPTIONS "$GIT_0K_BASE/0k/lxc-scripts.git" &&
  43. cd /opt/apps/0k-manage &&
  44. git checkout master &&
  45. ln -sf /opt/apps/lxc-scripts/bin/lxc-* /usr/local/sbin/ &&
  46. [ -d /usr/lib/lxc/templates ] && {
  47. ln -sf /opt/apps/lxc-scripts/usr/lib/lxc/templates/lxc-0k-ubuntu-cloud /usr/lib/lxc/templates/
  48. echo TEMPLATE_PATH=/usr/lib/lxc/templates >> /etc/default/lxc
  49. }
  50. [ -d /usr/share/lxc/templates ] && {
  51. ln -sf /opt/apps/lxc-scripts/usr/lib/lxc/templates/lxc-0k-ubuntu-cloud /usr/share/lxc/templates
  52. echo TEMPLATE_PATH=/usr/share/lxc/templates >> /etc/default/lxc
  53. }
  54. fi
  55. )