diff --git a/bbb-libreoffice/assets/convert-cool.sh b/bbb-libreoffice/assets/convert-cool.sh new file mode 100644 index 0000000000..918fa79b85 --- /dev/null +++ b/bbb-libreoffice/assets/convert-cool.sh @@ -0,0 +1,51 @@ +#!/bin/bash +set -e +set -u +PATH="/bin/:/usr/bin/" + +# This is a sample script - adjust it per your need, to use Collabora online. +# 1 - setup a server with Collabora Online (CODE) +# You can run it with +# docker run -t -d -p 127.0.0.1:9980:9980 -e "domain=" \ +# -e "username=admin" -e "password=S3cRet" --restart always collabora/code +# See https://sdk.collaboraonline.com/docs/installation/CODE_Docker_image.html +# Or you can use an existing setup you have. +# 2 - replace the HOST information below with your server host + +HOST=127.0.0.1 + +# Set this to "-k" to allow it to work in a test environment, ie with a self signed +# certificate +UNSECURE= + +# This script receives three params +# Param 1: Input office file path (e.g. "/tmp/test.odt") +# Param 2: Output pdf file path (e.g. "/tmp/test.pdf") +# Param 3: Destination Format (pdf default) +# Param 4: Timeout (secs) (optional) + +if (( $# == 0 )); then + echo "Missing parameter 1 (Input office file path)"; + exit 1 +elif (( $# == 1 )); then + echo "Missing parameter 2 (Output pdf file path)"; + exit 1 +fi; + + +source="$1" +dest="$2" + +# If output format is missing, define PDF +convertTo="${3:-pdf}" + +# If timeout is missing, define 60 +timeoutSecs="${4:-60}" +# Truncate timeout to max 3 digits (as expected by sudoers) +timeoutSecs="${timeoutSecs:0:3}" + +# The timeout is important. + +timeout $(printf %03d $timeoutSecs)s curl $UNSECURE -F "data=@${source}" https://$HOST:9980/cool/convert-to/$convertTo > "${dest}" + +exit 0 diff --git a/bbb-libreoffice/install-local.sh b/bbb-libreoffice/install-local.sh index 2e3448fb91..675128adc9 100755 --- a/bbb-libreoffice/install-local.sh +++ b/bbb-libreoffice/install-local.sh @@ -34,11 +34,9 @@ fi FOLDER_CHECK=`[ -d /usr/share/bbb-libreoffice-conversion/ ] && echo 1 || echo 0` if [ "$FOLDER_CHECK" = "0" ]; then echo "Install folder doesn't exists, installing" - mkdir -m 755 /usr/share/bbb-libreoffice-conversion/ - cp assets/convert-local.sh /usr/share/bbb-libreoffice-conversion/convert.sh - chmod 755 /usr/share/bbb-libreoffice-conversion/convert.sh - cp assets/etherpad-export.sh /usr/share/bbb-libreoffice-conversion/etherpad-export.sh - chmod 755 /usr/share/bbb-libreoffice-conversion/etherpad-export.sh + install -Dm755 assets/convert-local.sh /usr/share/bbb-libreoffice-conversion/convert.sh + install -Dm755 assets/convert-cool.sh /usr/share/bbb-libreoffice-conversion/convert-cool.sh + install -Dm755 assets/etherpad-export.sh /usr/share/bbb-libreoffice-conversion/etherpad-export.sh chown -R root /usr/share/bbb-libreoffice-conversion/ else echo "Install folder already exists" diff --git a/bbb-libreoffice/install-remote.sh b/bbb-libreoffice/install-remote.sh index e5a75eb05c..b19712b4e2 100755 --- a/bbb-libreoffice/install-remote.sh +++ b/bbb-libreoffice/install-remote.sh @@ -9,11 +9,9 @@ cd "$(dirname "$0")" FOLDER_CHECK=`[ -d /usr/share/bbb-libreoffice-conversion/ ] && echo 1 || echo 0` if [ "$FOLDER_CHECK" = "0" ]; then echo "Install folder doesn't exists, installing" - mkdir -m 755 /usr/share/bbb-libreoffice-conversion/ - cp assets/convert-remote.sh /usr/share/bbb-libreoffice-conversion/convert.sh - chmod 755 /usr/share/bbb-libreoffice-conversion/convert.sh - cp assets/etherpad-export.sh /usr/share/bbb-libreoffice-conversion/etherpad-export.sh - chmod 755 /usr/share/bbb-libreoffice-conversion/etherpad-export.sh + install -Dm755 assets/convert-remote.sh /usr/share/bbb-libreoffice-conversion/convert.sh + install -Dm755 assets/convert-cool.sh /usr/share/bbb-libreoffice-conversion/convert-cool.sh + install -Dm755 assets/etherpad-export.sh /usr/share/bbb-libreoffice-conversion/etherpad-export.sh chown -R root /usr/share/bbb-libreoffice-conversion/ else echo "Install folder already exists" diff --git a/build/packages-template/bbb-libreoffice-docker/after-install.sh b/build/packages-template/bbb-libreoffice-docker/after-install.sh index 43d8a46254..4f53a69508 100755 --- a/build/packages-template/bbb-libreoffice-docker/after-install.sh +++ b/build/packages-template/bbb-libreoffice-docker/after-install.sh @@ -16,6 +16,7 @@ fi #fi +chmod +x /usr/share/bbb-libreoffice-conversion/convert-cool.sh chmod +x /usr/share/bbb-libreoffice-conversion/convert-local.sh chmod +x /usr/share/bbb-libreoffice-conversion/convert-remote.sh chmod +x /usr/share/bbb-libreoffice-conversion/etherpad-export.sh diff --git a/build/packages-template/bbb-libreoffice-docker/build.sh b/build/packages-template/bbb-libreoffice-docker/build.sh index 3a26c8dfa0..c73109bbc5 100755 --- a/build/packages-template/bbb-libreoffice-docker/build.sh +++ b/build/packages-template/bbb-libreoffice-docker/build.sh @@ -21,9 +21,11 @@ if [ $DISTRO != "amzn2" ]; then fi cp assets/etherpad-export.sh staging/usr/share/bbb-libreoffice-conversion/etherpad-export.sh +cp assets/convert-local.sh staging/usr/share/bbb-libreoffice-conversion/convert-cool.sh cp assets/convert-local.sh staging/usr/share/bbb-libreoffice-conversion/convert-local.sh cp assets/convert-remote.sh staging/usr/share/bbb-libreoffice-conversion/convert-remote.sh +chmod +x staging/usr/share/bbb-libreoffice-conversion/convert-cool.sh chmod +x staging/usr/share/bbb-libreoffice-conversion/convert-local.sh chmod +x staging/usr/share/bbb-libreoffice-conversion/convert-remote.sh chmod +x staging/usr/share/bbb-libreoffice-conversion/etherpad-export.sh