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.

61 lines
1.5 KiB

  1. #!/bin/bash
  2. set -ex # -x for verbose logging to juju debug-log
  3. ##
  4. ## Options (changeable thanks to ``/etc/charm/openerp.conf``)
  5. ##
  6. export OPENERP_PASSWORD=${OPENERP_PASSWORD:-openerp_password}
  7. ## 0k git remote path
  8. export GIT_0K_BASE=${GIT_0K_BASE:-"git.0k.io:/var/git"}
  9. ## 0k git remote options
  10. export GIT_0K_CLONE_OPTIONS=${GIT_0K_CLONE_OPTIONS:-""}
  11. ## 0k git-sub setup options
  12. export GIT_0K_SUB_CLONE_OPTIONS=${GIT_0K_SUB_CLONE_OPTIONS:-""}
  13. ## 0k git default checkout reference (for 0k-oe root package)
  14. export GIT_0K_CHECKOUT_REF=${GIT_0K_CHECKOUT_REF:-"8.0/0k/dev/master"}
  15. ## set only if not already set:
  16. export VIRTUALENV=${VIRTUALENV-/srv/virtualenv/default}
  17. RELEASE=${RELEASE:-}
  18. test -z "$RELEASE" && export RELEASE=$(lsb_release -c -s)
  19. ##
  20. ## Code
  21. ##
  22. (
  23. mkdir -p /opt/apps
  24. cd /opt/apps || exit 1
  25. if ! [ -d /opt/apps/0k-oe ]; then
  26. if [ "$ODOO_CP_FROM_DIR" ]; then
  27. cp -a "$ODOO_CP_FROM_DIR" "/opt/apps/0k-oe"
  28. else
  29. apt-get install -y python-pip && pip install shyaml
  30. git sub clone $GIT_0K_CLONE_OPTIONS $GIT_0K_SUB_CLONE_OPTIONS -b "$GIT_0K_CHECKOUT_REF" \
  31. "$GIT_0K_BASE"/0k/0k-oe
  32. fi
  33. fi &&
  34. cd 0k-oe/charm &&
  35. find install.d/ -mindepth 1 -maxdepth 1 -executable -regex 'install.d/[0-9]+-.*' | sort -n |
  36. while read script; do
  37. echo "=== LAUNCHING SCRIPT: $script"
  38. "$script"
  39. errlvl=$?
  40. echo "=== EXIT OF SCRIPT: $script, ERRLVL: $errlvl"
  41. if [ "$errlvl" != 0 ]; then
  42. exit 1
  43. fi
  44. done
  45. ) || exit 1