From e1548179fc706f193be44655bc5fb91f18901c9e Mon Sep 17 00:00:00 2001 From: Disassembler Date: Fri, 30 Jun 2017 18:17:07 +0200 Subject: [PATCH] Rework SeedDMS - install from git --- seeddms.sh | 38 ++++++++++++++++++++++----- seeddms/srv/seeddms/conf/settings.xml | 35 ++++++++++++++++++++++++ seeddms/tmp/createdb-seeddms.sql | 4 +++ 3 files changed, 71 insertions(+), 6 deletions(-) create mode 100644 seeddms/srv/seeddms/conf/settings.xml create mode 100644 seeddms/tmp/createdb-seeddms.sql diff --git a/seeddms.sh b/seeddms.sh index e010fc0..94bd4e1 100644 --- a/seeddms.sh +++ b/seeddms.sh @@ -3,12 +3,38 @@ SOURCE_DIR=$(realpath $(dirname "${0}")) # Install dependencies for SeedDMS -apt-get --no-install-recommends install php7.0-gd php7.0-fpm php7.0-mbstring php7.0-xml +apt-get -y --no-install-recommends install php7.0-gd php7.0-fpm php7.0-mbstring php7.0-pgsql php7.0-xml php-log php-mail php-pear # Install SeedDMS -wget https://sourceforge.net/projects/seeddms/files/seeddms-5.0.11/seeddms-5.0.11.tar.gz/download -O /srv/seeddms-5.0.11.tar.gz -tar xf /srv/seeddms-5.0.11.tar.gz -C /srv/ -mv /srv/seeddms-5.0.11 /srv/seeddms +git clone https://git.code.sf.net/p/seeddms/code /srv/seeddms +git -C /srv/seeddms checkout seeddms-5.1.x +rm -rf /srv/seeddms/.git + +# Populate database +export SEEDDMS_PWD=$(head -c 260 /dev/urandom | tr -cd '[:alnum:]' | head -c 26) +envsubst <${SOURCE_DIR}/seeddms/tmp/createdb-seeddms.sql >/tmp/createdb-seeddms.sql +sudo -u postgres psql -f /tmp/createdb-seeddms.sql +rm -f /tmp/createdb-seeddms.sql +export PGPASSWORD=${SEEDDMS_PWD} +psql -f /srv/seeddms/install/create_tables-postgres.sql seeddms seeddms +unset PGPASSWORD + +# Configure SeedDMS +envsubst <${SOURCE_DIR}/seeddms/srv/seeddms/conf/settings.xml >/srv/seeddms/conf/settings.xml + +# Adjust directory structure +mkdir -p /srv/seeddms/data/{lucene,staging,cache} +mkdir /srv/seeddms/SeedDMS +mv /srv/seeddms/SeedDMS_Core/Core* /srv/seeddms/SeedDMS/ +mv /srv/seeddms/SeedDMS_Lucene/Lucene* /srv/seeddms/SeedDMS/ +mv /srv/seeddms/SeedDMS_Preview/Preview* /srv/seeddms/SeedDMS/ +mv /srv/seeddms/SeedDMS_SQLiteFTS/SQLiteFTS* /srv/seeddms/SeedDMS/ + +rm -rf /srv/seeddms/SeedDMS_* +rm -rf /srv/seeddms/install/ +rm -rf /srv/seeddms/ext/example/ + +chown -R www-data:www-data /srv/seeddms/ # Create nginx app definition cp ${SOURCE_DIR}/seeddms/etc/nginx/apps-available/seeddms /etc/nginx/apps-available/seeddms @@ -19,5 +45,5 @@ systemctl restart nginx # TODO: Custom user # TODO: Set cgroups -# TODO: Dependencies (both PHP and PEAR) -# TODO: Does it run on PostgeSQL or MariaDB only? +# TODO: id3 ssconvers pdftotext catdoc +# TODO: Test Lucene fulltext search diff --git a/seeddms/srv/seeddms/conf/settings.xml b/seeddms/srv/seeddms/conf/settings.xml new file mode 100644 index 0000000..fac5cfb --- /dev/null +++ b/seeddms/srv/seeddms/conf/settings.xml @@ -0,0 +1,35 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + pdftotext -enc UTF-8 -nopgbrk %s - | sed -e 's/ [a-zA-Z0-9.]\{1\} / /g' -e 's/[0-9.]//g' + catdoc %s + ssconvert -T Gnumeric_stf:stf_csv -S %s fd://1 + id3 -l -R %s | egrep '(Title|Artist|Album)' | sed 's/^[^:]*: //g' + id3 -l -R %s | egrep '(Title|Artist|Album)' | sed 's/^[^:]*: //g' + cat %s + + + + diff --git a/seeddms/tmp/createdb-seeddms.sql b/seeddms/tmp/createdb-seeddms.sql new file mode 100644 index 0000000..a1c85b5 --- /dev/null +++ b/seeddms/tmp/createdb-seeddms.sql @@ -0,0 +1,4 @@ +CREATE ROLE seeddms NOSUPERUSER NOCREATEDB NOCREATEROLE NOINHERIT LOGIN ENCRYPTED PASSWORD '${SEEDDMS_PWD}'; +CREATE DATABASE seeddms; +REVOKE ALL ON DATABASE seeddms FROM public; +ALTER DATABASE seeddms OWNER TO seeddms;