From 236c15dbac367f9b9778077b4fe7a51a4a5a8005 Mon Sep 17 00:00:00 2001 From: Disassembler Date: Mon, 23 Mar 2020 11:32:11 +0100 Subject: [PATCH] Make SeedDMS SPOC-compatible, cont'd --- lxc-apps/seeddms/image | 8 +-- .../seeddms/image.d/etc/php7/php-fpm.conf | 1 - .../image.d/srv/seeddms/previewers.patch | 58 ------------------- .../srv/seeddms/seeddms/utils/seeddms-indexer | 22 +++---- lxc-apps/seeddms/install.sh | 2 +- 5 files changed, 13 insertions(+), 78 deletions(-) delete mode 100644 lxc-apps/seeddms/image.d/srv/seeddms/previewers.patch diff --git a/lxc-apps/seeddms/image b/lxc-apps/seeddms/image index 5e9b867..75e6629 100644 --- a/lxc-apps/seeddms/image +++ b/lxc-apps/seeddms/image @@ -21,11 +21,6 @@ EOF COPY image.d RUN EOF - # Patch Previewers - cd /srv/seeddms - #TODO: patch -p0 converters = array( -- 'application/vnd.openxmlformats-officedocument.wordprocessingml.document' => "unoconv -d document -f pdf --stdout -v '%f' > '%o'", -- 'application/vnd.oasis.opendocument.text' => "unoconv -d document -f pdf --stdout -v '%f' > '%o'", -- 'text/rtf' => "unoconv -d document -f pdf --stdout -v '%f' > '%o'", -- 'application/msword' => "unoconv -d document -f pdf --stdout -v '%f' > '%o'", -- 'application/vnd.ms-excel' => "unoconv -d document -f pdf --stdout -v '%f' > '%o'", -- 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet' => "unoconv -d document -f pdf --stdout -v '%f' > '%o'", -- 'text/plain' => "unoconv -d document -f pdf --stdout -v '%f' > '%o'", -- 'application/postscript' => "ps2pdf '%f' - > '%o'", -- 'image/jpeg' => "convert '%f' pdf:- > '%o'", -- 'image/png' => "convert '%f' pdf:- > '%o'", -- 'image/gif' => "convert '%f' pdf:- > '%o'", -- 'video/mp4' => "convert '%f[1-20]' pdf:- > '%o'", -+ 'text/rtf' => "unoconv -d document -f pdf -o '%o' '%f'", -+ 'application/msword' => "unoconv -d document -f pdf -o '%o' '%f'", -+ 'application/vnd.oasis.opendocument.text' => "unoconv -d document -f pdf -o '%o' '%f'", -+ 'application/vnd.openxmlformats-officedocument.wordprocessingml.document' => "unoconv -d document -f pdf -o '%o' '%f'", -+ 'application/vnd.ms-excel' => "unoconv -d spreadsheet -f pdf -o '%o' '%f'", -+ 'application/vnd.oasis.opendocument.spreadsheet' => "unoconv -d spreadsheet -f pdf -o '%o' '%f'", -+ 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet' => "unoconv -d spreadsheet -f pdf -o '%o' '%f'", -+ 'application/vnd.ms-powerpoint' => "unoconv -d presentation -f pdf -o '%o' '%f'", -+ 'application/vnd.oasis.opendocument.presentation' => "unoconv -d presentation -f pdf -o '%o' '%f'", -+ 'application/vnd.openxmlformats-officedocument.presentationml.presentation' => "unoconv -d presentation -f pdf -o '%o' '%f'", -+ 'text/html' => "unoconv -d document -f pdf -o '%o' '%f'", -+ 'text/plain' => "unoconv -d document -f pdf -o '%o' '%f'", - ); - } /* }}} */ - ---- orig/SeedDMS/Preview/Previewer.php -+++ pear/SeedDMS/Preview/Previewer.php -@@ -37,10 +37,19 @@ - 'image/jpg' => "convert -resize %wx '%f' '%o'", - 'image/jpeg' => "convert -resize %wx '%f' '%o'", - 'image/svg+xml' => "convert -resize %wx '%f' '%o'", -- 'text/plain' => "convert -resize %wx '%f' '%o'", - 'application/pdf' => "convert -density 100 -resize %wx '%f[0]' '%o'", -- 'application/postscript' => "convert -density 100 -resize %wx '%f[0]' '%o'", -- 'application/x-compressed-tar' => "tar tzvf '%f' | convert -density 100 -resize %wx text:-[0] '%o'", -+ 'text/plain' => "unoconv -d document -e PageRange=1-1 -f pdf --stdout '%f' | gs -dBATCH -dNOPAUSE -sDEVICE=pngalpha -dPDFFitPage -r72 -sOutputFile=- -q - | convert -resize %wx png:- '%o'", -+ 'text/html' => "unoconv -d document -e PageRange=1-1 -f pdf --stdout '%f' | gs -dBATCH -dNOPAUSE -sDEVICE=pngalpha -dPDFFitPage -r72 -sOutputFile=- -q - | convert -resize %wx png:- '%o'", -+ 'text/rtf' => "unoconv -d document -e PageRange=1-1 -f pdf --stdout '%f' | gs -dBATCH -dNOPAUSE -sDEVICE=pngalpha -dPDFFitPage -r72 -sOutputFile=- -q - | convert -resize %wx png:- '%o'", -+ 'application/msword' => "unoconv -d document -e PageRange=1-1 -f pdf --stdout '%f' | gs -dBATCH -dNOPAUSE -sDEVICE=pngalpha -dPDFFitPage -r72 -sOutputFile=- -q - | convert -resize %wx png:- '%o'", -+ 'application/vnd.oasis.opendocument.text' => "unoconv -d document -e PageRange=1-1 -f pdf --stdout '%f' | gs -dBATCH -dNOPAUSE -sDEVICE=pngalpha -dPDFFitPage -r72 -sOutputFile=- -q - | convert -resize %wx png:- '%o'", -+ 'application/vnd.openxmlformats-officedocument.wordprocessingml.document' => "unoconv -d document -e PageRange=1-1 -f pdf --stdout '%f' | gs -dBATCH -dNOPAUSE -sDEVICE=pngalpha -dPDFFitPage -r72 -sOutputFile=- -q - | convert -resize %wx png:- '%o'", -+ 'application/vnd.ms-excel' => "unoconv -d spreadsheet -e PageRange=1-1 -f pdf --stdout '%f' | gs -dBATCH -dNOPAUSE -sDEVICE=pngalpha -dPDFFitPage -r72 -sOutputFile=- -q - | convert -resize %wx png:- '%o'", -+ 'application/vnd.oasis.opendocument.spreadsheet' => "unoconv -d spreadsheet -e PageRange=1-1 -f pdf --stdout '%f' | gs -dBATCH -dNOPAUSE -sDEVICE=pngalpha -dPDFFitPage -r72 -sOutputFile=- -q - | convert -resize %wx png:- '%o'", -+ 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet' => "unoconv -d spreadsheet -e PageRange=1-1 -f pdf --stdout '%f' | gs -dBATCH -dNOPAUSE -sDEVICE=pngalpha -dPDFFitPage -r72 -sOutputFile=- -q - | convert -resize %wx png:- '%o'", -+ 'application/vnd.ms-powerpoint' => "unoconv -d presentation -e PageRange=1-1 -f pdf --stdout '%f' | gs -dBATCH -dNOPAUSE -sDEVICE=pngalpha -dPDFFitPage -r72 -sOutputFile=- -q - | convert -resize %wx png:- '%o'", -+ 'application/vnd.oasis.opendocument.presentation' => "unoconv -d presentation -e PageRange=1-1 -f pdf --stdout '%f' | gs -dBATCH -dNOPAUSE -sDEVICE=pngalpha -dPDFFitPage -r72 -sOutputFile=- -q - | convert -resize %wx png:- '%o'", -+ 'application/vnd.openxmlformats-officedocument.presentationml.presentation' => "unoconv -d presentation -e PageRange=1-1 -f pdf --stdout '%f' | gs -dBATCH -dNOPAUSE -sDEVICE=pngalpha -dPDFFitPage -r72 -sOutputFile=- -q - | convert -resize %wx png:- '%o'", - ); - $this->width = intval($width); - } /* }}} */ diff --git a/lxc-apps/seeddms/image.d/srv/seeddms/seeddms/utils/seeddms-indexer b/lxc-apps/seeddms/image.d/srv/seeddms/seeddms/utils/seeddms-indexer index 80e7616..2470630 100755 --- a/lxc-apps/seeddms/image.d/srv/seeddms/seeddms/utils/seeddms-indexer +++ b/lxc-apps/seeddms/image.d/srv/seeddms/seeddms/utils/seeddms-indexer @@ -1,11 +1,11 @@ -#!/bin/sh - -# Prevent indexer jobs to run simultaneously by using a file lock -cd /srv/seeddms/seeddms/utils/ -( - if ! flock -n 3; then - echo "Indexer is still running" - exit 1 - fi - /usr/bin/php indexer.php --config /srv/seeddms/conf/settings.xml -) 3>indexer.lock +#!/bin/sh + +# Prevent indexer jobs to run simultaneously by using a file lock +cd /srv/seeddms/seeddms/utils/ +( + if ! flock -n 3; then + echo "Indexer is still running" + exit 1 + fi + /usr/bin/php indexer.php --config /srv/seeddms/conf/settings.xml +) 3>indexer.lock diff --git a/lxc-apps/seeddms/install.sh b/lxc-apps/seeddms/install.sh index b368d28..08f2a7a 100755 --- a/lxc-apps/seeddms/install.sh +++ b/lxc-apps/seeddms/install.sh @@ -23,7 +23,7 @@ cp -rp ${SEEDDMS_LAYER}/srv/seeddms/data ${SEEDDMS_DATA} export SEEDDMS_PWD=$(head -c 18 /dev/urandom | base64 | tr -d '+/=') spoc-container start seeddms-postgres envsubst