From 671ac64441b87cede2ad916e4042ad42208a7c7a Mon Sep 17 00:00:00 2001 From: Valentin Lab Date: Wed, 9 Dec 2020 10:56:00 +0100 Subject: [PATCH] chg: [onlyoffice] rebuild config when new image is used Signed-off-by: Valentin Lab --- onlyoffice/hooks/init | 20 +++++++++++++++++--- 1 file changed, 17 insertions(+), 3 deletions(-) diff --git a/onlyoffice/hooks/init b/onlyoffice/hooks/init index 6f7a4d78..f373e2c6 100755 --- a/onlyoffice/hooks/init +++ b/onlyoffice/hooks/init @@ -13,9 +13,23 @@ set -e -if ! [ -e "$SERVICE_CONFIGSTORE/etc/onlyoffice/documentserver/local.json" ]; then +image_id=$(service_base_image_id "$SERVICE_NAME") || { + err "couldn't get image id of $SERVICE_NAME." + exit 1 +} + +CONTROL_FILE="$SERVICE_CONFIGSTORE/etc/onlyoffice/.image_id" +if [ "$(cat "$CONTROL_FILE")" != "$image_id" ]; then ## first time we need to extract configuration from image + rm -rf "$SERVICE_CONFIGSTORE/etc/onlyoffice" mkdir -p "$SERVICE_CONFIGSTORE/etc/onlyoffice" service_base_image_export_dir "$SERVICE_NAME" /etc/onlyoffice/documentserver "$SERVICE_CONFIGSTORE/etc/onlyoffice/" -fi - + printf "%s" "$image_id" > "$CONTROL_FILE" +else + ## probably not needed to regenerate fonts + init-config-add "\ +$MASTER_BASE_SERVICE_NAME: + environment: + GENERATE_FONTS: \"false\" +" +fi \ No newline at end of file