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.
50 lines
1.4 KiB
50 lines
1.4 KiB
# -*- mode: sh -*-
|
|
|
|
|
|
COMPOSER_DIR="$SERVICE_CONFIGSTORE/root/.composer"
|
|
FRAMADATE_CODE="$SERVICE_CONFIGSTORE/opt/apps/framadate"
|
|
|
|
dcomposer() {
|
|
docker run --rm -v "$COMPOSER_DIR:/root/.composer" \
|
|
-v "$FRAMADATE_CODE:/opt/apps/framadate" \
|
|
-w "/opt/apps/framadate" \
|
|
--env "COMPOSER_ALLOW_SUPERUSER=1" \
|
|
composer:latest "-vvv" "--working-dir=/opt/apps/framadate" "$@"
|
|
}
|
|
|
|
|
|
|
|
cfg_dir_init() {
|
|
local locations candidate_location cfg_dir
|
|
|
|
if [ "$BASE_SERVICE_NAME" ]; then
|
|
candidate_location=("$DATASTORE/$BASE_SERVICE_NAME/var/www/"*"/app/inc/")
|
|
else
|
|
candidate_location=("$DATASTORE/$SERVICE_NAME/var/www/"*"/app/inc/")
|
|
fi
|
|
|
|
locations=()
|
|
for location in "${candidate_location[@]}"; do
|
|
[ -d "${location[0]}" ] || continue
|
|
locations+=("$location")
|
|
done
|
|
|
|
case "${#locations[@]}" in
|
|
0)
|
|
debug "Relation publish-dir did not yet copy config files"
|
|
## not yet copied
|
|
cfg_dir="$FRAMADATE_CODE/app/inc/"
|
|
;;
|
|
1)
|
|
debug "Relation publish-dir already copied config files"
|
|
cfg_dir="${locations[0]}"
|
|
;;
|
|
*)
|
|
err "Unexpected: there are more than one directory in $DATASTORE/$BASE_SERVICE_NAME/var/www/"
|
|
exit 1
|
|
;;
|
|
esac
|
|
|
|
debug "found location: $cfg_dir" >&2
|
|
echo "$cfg_dir"
|
|
}
|