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.

49 lines
1.4 KiB

  1. # -*- mode: sh -*-
  2. COMPOSER_DIR="$SERVICE_CONFIGSTORE/root/.composer"
  3. FRAMADATE_CODE="$SERVICE_CONFIGSTORE/opt/apps/framadate"
  4. dcomposer() {
  5. docker run --rm -v "$COMPOSER_DIR:/root/.composer" \
  6. -v "$FRAMADATE_CODE:/opt/apps/framadate" \
  7. -w "/opt/apps/framadate" \
  8. --env "COMPOSER_ALLOW_SUPERUSER=1" \
  9. composer:latest "-vvv" "--working-dir=/opt/apps/framadate" "$@"
  10. }
  11. cfg_dir_init() {
  12. local locations candidate_location cfg_dir
  13. if [ "$BASE_SERVICE_NAME" ]; then
  14. candidate_location=("$DATASTORE/$BASE_SERVICE_NAME/var/www/"*"/app/inc/")
  15. else
  16. candidate_location=("$DATASTORE/$SERVICE_NAME/var/www/"*"/app/inc/")
  17. fi
  18. locations=()
  19. for location in "${candidate_location[@]}"; do
  20. [ -d "${location[0]}" ] || continue
  21. locations+=("$location")
  22. done
  23. case "${#locations[@]}" in
  24. 0)
  25. debug "Relation publish-dir did not yet copy config files"
  26. ## not yet copied
  27. cfg_dir="$FRAMADATE_CODE/app/inc/"
  28. ;;
  29. 1)
  30. debug "Relation publish-dir already copied config files"
  31. cfg_dir="${locations[0]}"
  32. ;;
  33. *)
  34. err "Unexpected: there are more than one directory in $DATASTORE/$BASE_SERVICE_NAME/var/www/"
  35. exit 1
  36. ;;
  37. esac
  38. debug "found location: $cfg_dir" >&2
  39. echo "$cfg_dir"
  40. }