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

  1. #!/bin/bash
  2. ## Init is run on host
  3. ## For now it is run every time the script is launched, but
  4. ## it should be launched only once after build.
  5. ## Accessible variables are:
  6. ## - SERVICE_NAME Name of current service
  7. ## - DOCKER_BASE_IMAGE Base image from which this service might be built if any
  8. ## - SERVICE_DATASTORE Location on host of the DATASTORE of this service
  9. ## - SERVICE_CONFIGSTORE Location on host of the CONFIGSTORE of this service
  10. set -e
  11. image_id=$(service_base_image_id "$SERVICE_NAME") || {
  12. err "couldn't get image id of $SERVICE_NAME."
  13. exit 1
  14. }
  15. CONTROL_FILE="$SERVICE_CONFIGSTORE/etc/onlyoffice/.image_id"
  16. if [ "$(cat "$CONTROL_FILE")" != "$image_id" ]; then
  17. ## first time we need to extract configuration from image
  18. rm -rf "$SERVICE_CONFIGSTORE/etc/onlyoffice"
  19. mkdir -p "$SERVICE_CONFIGSTORE/etc/onlyoffice"
  20. service_base_image_export_dir "$SERVICE_NAME" /etc/onlyoffice/documentserver "$SERVICE_CONFIGSTORE/etc/onlyoffice/"
  21. printf "%s" "$image_id" > "$CONTROL_FILE"
  22. else
  23. ## probably not needed to regenerate fonts
  24. init-config-add "\
  25. $MASTER_BASE_SERVICE_NAME:
  26. environment:
  27. GENERATE_FONTS: \"false\"
  28. "
  29. fi