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.

37 lines
1.4 KiB

  1. #!/bin/bash
  2. if [ -z "$SERVICE_DATASTORE" ]; then
  3. echo "This script is meant to be run through 'compose' to work properly." >&2
  4. exit 1
  5. fi
  6. export COMPOSE_IGNORE_ORPHANS=True
  7. if ! [ -e "$SERVICE_DATASTORE/var/www/html/occ" ]; then
  8. ## Here we use a nasty trick to launch only the initialisation
  9. ## part of the ``entrypoint.sh``. By setting 'apache' as first
  10. ## call argument, we satisfy the big first 'if' condition
  11. ## triggering the installation if necessary, and will fail to
  12. ## launch any apache
  13. ## Last, we do not want the relation web-proxy to run in this
  14. ## bare-minimum nextcloud run AND we will use occ to set some info
  15. ## in this very same relation.
  16. compose --debug --without-relation="$SERVICE_NAME":web-proxy run \
  17. --rm --entrypoint /entrypoint.sh "$SERVICE_NAME" apache >&2 || true
  18. if ! [ -e "$SERVICE_DATASTORE/var/www/html/occ" ]; then
  19. err "Expected last command to create /var/www/html/occ"
  20. exit 1
  21. fi
  22. fi
  23. ## occ.batch will require /var/www/html to be populated ('occ' is
  24. ## supposed to exist). For that we need to make sure nextcloud have
  25. ## be ran and setup prior to running this next command.
  26. compose -q --no-init --no-relations run \
  27. -v "$HOST_CHARM_STORE/${CHARM_REL_PATH#${CHARM_STORE}/}/src/occ.batch:/var/www/html/occ.batch" \
  28. -T --rm -u www-data "$SERVICE_NAME" /var/www/html/occ.batch "$@" | cat
  29. exit "${PIPESTATUS[0]}"