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.

64 lines
1.6 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:-admin}
  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. ## debian does not include lsb_release, but it is ok since
  19. ## it receives its release info from 0k-odoo-light. But, herk.
  20. test -z "$RELEASE" && export RELEASE=$(lsb_release -c -s)
  21. ##
  22. ## Code
  23. ##
  24. (
  25. mkdir -p /opt/apps
  26. cd /opt/apps || exit 1
  27. if ! [ -d /opt/apps/0k-oe ]; then
  28. if [ "$ODOO_CP_FROM_DIR" ]; then
  29. cp -a "$ODOO_CP_FROM_DIR" "/opt/apps/0k-oe"
  30. else
  31. apt-get install -y python-pip && pip install shyaml
  32. git sub clone $GIT_0K_CLONE_OPTIONS $GIT_0K_SUB_CLONE_OPTIONS -b "$GIT_0K_CHECKOUT_REF" \
  33. "$GIT_0K_BASE"/0k/0k-oe
  34. fi
  35. fi &&
  36. cd 0k-oe/charm &&
  37. find install.d/ -mindepth 1 -maxdepth 1 -executable -regex 'install.d/[0-9]+-.*' | sort -n |
  38. while read script; do
  39. echo "=== LAUNCHING SCRIPT: $script"
  40. "$script"
  41. errlvl=$?
  42. echo "=== EXIT OF SCRIPT: $script, ERRLVL: $errlvl"
  43. if [ "$errlvl" != 0 ]; then
  44. exit 1
  45. fi
  46. done
  47. ) || exit 1