forked from 0k/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.
34 lines
1.2 KiB
34 lines
1.2 KiB
#!/bin/bash
|
|
|
|
if [ -z "$SERVICE_DATASTORE" ]; then
|
|
echo "This script is meant to be run through 'compose' to work properly." >&2
|
|
exit 1
|
|
fi
|
|
|
|
|
|
export COMPOSE_IGNORE_ORPHANS=True
|
|
|
|
|
|
if ! [ -e "$SERVICE_DATASTORE/var/www/html/occ" ]; then
|
|
## Here we use a nasty trick to launch only the initialisation
|
|
## part of the ``entrypoint.sh``. By setting 'apache' as first
|
|
## call argument, we satisfy the big first 'if' condition
|
|
## triggering the installation if necessary, and will fail to
|
|
## launch any apache
|
|
|
|
## Last, we do not want the relation web-proxy to run in this
|
|
## bare-minimum nextcloud run AND we will use occ to set some info
|
|
## in this very same relation.
|
|
compose --without-relation="$SERVICE_NAME":web-proxy run \
|
|
--rm --entrypoint /entrypoint.sh "$SERVICE_NAME" apache >&2 || true
|
|
fi
|
|
|
|
|
|
## occ.batch will require /var/www/html to be populated ('occ' is
|
|
## supposed to exist). For that we need to make sure nextcloud have
|
|
## be ran and setup prior to running this next command.
|
|
compose -q --no-init --no-relations run \
|
|
-v "$CHARM_PATH/src/occ.batch:/var/www/html/occ.batch" \
|
|
-T --rm -u www-data "$SERVICE_NAME" /var/www/html/occ.batch "$@" | cat
|
|
|
|
exit "${PIPESTATUS[0]}"
|