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.

32 lines
1.2 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 --without-relation="$SERVICE_NAME":web-proxy run \
  17. --rm --entrypoint /entrypoint.sh "$SERVICE_NAME" apache >&2 || true
  18. fi
  19. ## occ.batch will require /var/www/html to be populated ('occ' is
  20. ## supposed to exist). For that we need to make sure nextcloud have
  21. ## be ran and setup prior to running this next command.
  22. compose -q --no-init --no-relations run \
  23. -v "$CHARM_PATH/src/occ.batch:/var/www/html/occ.batch" \
  24. -T --rm -u www-data "$SERVICE_NAME" /var/www/html/occ.batch "$@" | cat