master
Yves G 2017-10-06 14:51:18 +02:00 committed by Y
commit 77d5f9122f
7 changed files with 425 additions and 0 deletions

99
.SRCINFO Normal file
View File

@ -0,0 +1,99 @@
pkgbase = collabora-online-server-nodocker
pkgdesc = Collabora CODE (LibreOffice Online) server for Nextcloud or ownCloud, without Docker
pkgver = 2.1.4
pkgrel = 1
url = https://www.collaboraoffice.com/code/
install = install
arch = x86_64
license = MPL
depends = gcc-libs
depends = libcap
depends = libpng12
depends = poco
depends = openssl-1.0
depends = fontconfig
depends = libsm
depends = unixodbc
depends = libxinerama
depends = cairo
depends = mesa-libgl
depends = libcups
depends = dbus-glib
optdepends = hunspell-de: German hunspell dictionaries for LibreOffice
optdepends = hunspell-en: English (US, UK, etc.) hunspell dictionaries for LibreOffice
optdepends = hunspell-en_AU: AU English hunspell dictionaries for LibreOffice
optdepends = hunspell-en_CA: CA English hunspell dictionaries for LibreOffice
optdepends = hunspell-en_GB: GB English hunspell dictionaries for LibreOffice
optdepends = hunspell-en_US: US English hunspell dictionaries for LibreOffice
optdepends = hunspell-es: Spanish hunspell dictionaries for LibreOffice
optdepends = hunspell-fr: French (modern) hunspell dictionaries for LibreOffice
optdepends = hunspell-he: Hebrew hunspell dictionary for LibreOffice
optdepends = hunspell-it: Italian dictionary for Hunspell for LibreOffice
optdepends = hunspell-ro: Romanian dictionary for Hunspell for LibreOffice
optdepends = hunspell-el: Greek hunspell dictionary for LibreOffice
optdepends = hunspell-hu: Hungarian hunspell dictionary for LibreOffice
optdepends = hunspell-nl: Dutch hunspell dictionaries for LibreOffice
optdepends = hunspell-pl: Polish dictionary for Hunspell for LibreOffice
optdepends = hyphen-de: German hyphenation rules for LibreOffice
optdepends = hyphen-en: English hyphenation rules for LibreOffice
optdepends = hyphen-es: Spanish hyphenation rules for LibreOffice
optdepends = hyphen-fr: French hyphenation rules for LibreOffice
optdepends = hyphen-it: Italian hyphenation rules for LibreOffice
optdepends = hyphen-nl: Dutch hyphenation rules for LibreOffice
optdepends = hyphen-ro: Romanian hyphenation rules for LibreOffice
optdepends = hyphen-hu: Hungarian hyphenation rules for LibreOffice
optdepends = hyphen-pl: Polish hyphenation rules for LibreOffice
provides = libreoffice
provides = libreoffice-en-US
backup = opt/collaboraoffice5.3/share/psprint/psprint.conf
backup = etc/loolwsd/loolkitconfig.xcu
backup = etc/loolwsd/loolwsd.xml
source = https://www.collaboraoffice.com/repos/CollaboraOnline/CODE/Packages
source = install
source = mkcert_example.sh
source = nginx.conf
source = sysusers
source = tmpfiles
source = https://www.collaboraoffice.com/repos/CollaboraOnline/CODE/loolwsd_2.1.4-3_amd64.deb
source = https://www.collaboraoffice.com/repos/CollaboraOnline/CODE/collaboraofficebasis5.3-calc_5.3.10.28-28_amd64.deb
source = https://www.collaboraoffice.com/repos/CollaboraOnline/CODE/collaboraofficebasis5.3-core_5.3.10.28-28_amd64.deb
source = https://www.collaboraoffice.com/repos/CollaboraOnline/CODE/collaboraoffice5.3-ure_5.3.10.28-28_amd64.deb
source = https://www.collaboraoffice.com/repos/CollaboraOnline/CODE/collaboraofficebasis5.3-graphicfilter_5.3.10.28-28_amd64.deb
source = https://www.collaboraoffice.com/repos/CollaboraOnline/CODE/collaboraofficebasis5.3-images_5.3.10.28-28_amd64.deb
source = https://www.collaboraoffice.com/repos/CollaboraOnline/CODE/collaboraofficebasis5.3-impress_5.3.10.28-28_amd64.deb
source = https://www.collaboraoffice.com/repos/CollaboraOnline/CODE/collaboraofficebasis5.3-ooofonts_5.3.10.28-28_amd64.deb
source = https://www.collaboraoffice.com/repos/CollaboraOnline/CODE/collaboraofficebasis5.3-writer_5.3.10.28-28_amd64.deb
source = https://www.collaboraoffice.com/repos/CollaboraOnline/CODE/collaboraoffice5.3_5.3.10.28-28_amd64.deb
source = https://www.collaboraoffice.com/repos/CollaboraOnline/CODE/collaboraofficebasis5.3-en-us_5.3.10.28-28_amd64.deb
source = https://www.collaboraoffice.com/repos/CollaboraOnline/CODE/collaboraofficebasis5.3-en-us-calc_5.3.10.28-28_amd64.deb
source = https://www.collaboraoffice.com/repos/CollaboraOnline/CODE/collaboraofficebasis5.3-en-us-res_5.3.10.28-28_amd64.deb
source = https://www.collaboraoffice.com/repos/CollaboraOnline/CODE/collaboraofficebasis5.3-noto-fonts_5.3.10.28-28_amd64.deb
source = https://www.collaboraoffice.com/repos/CollaboraOnline/CODE/collaboraofficebasis5.3-draw_5.3.10.28-28_amd64.deb
source = https://www.collaboraoffice.com/repos/CollaboraOnline/CODE/collaboraofficebasis5.3-extension-pdf-import_5.3.10.28-28_amd64.deb
source = https://www.collaboraoffice.com/repos/CollaboraOnline/CODE/code-brand_2.0.2-3_all.deb
sha1sums = fab66ee561bee5d004068c7c5090b70f91a9fb99
sha1sums = 20e4371fe6f03e53684759a11260b71e0f844401
sha1sums = 68ac242ad285eeeca07cb486c22dfbf3a658fe81
sha1sums = fe998836dbbd5c153de77d4ea877f25719dae304
sha1sums = 2d271f9493ea14c675af1bfa76f6b654569dd51f
sha1sums = f9c102a06b2582548f13121e78790237e2cb38e1
sha1sums = ee41bb41d18a8af989ccbb297daea641c3d870d6
sha1sums = 021cc0d70f7777745f35f1ab92e701f956d1d837
sha1sums = de135aa7d17303344ba4014d72876e57b0a276a1
sha1sums = dc7741cd9d6786c5cd0b4e9631c674bbbbb148ff
sha1sums = 96c25ee57f9347d006222fc20e8c8b83bc1ecef6
sha1sums = 15ad54449c7257ff9430987fda334616d8649d91
sha1sums = 213f4ab3c1c9677708a05d5454bc75a020e78b38
sha1sums = 4e8c82a8ff2589c8814429511230827d0d38b6ef
sha1sums = 4a8dc86035c9c4bbe957cf70e0bade7337a3e79d
sha1sums = 284886cdd43fae3850c960b9141ce8b2e744bbcc
sha1sums = c8e6bbf518a63ca977081871397bc624e89219bc
sha1sums = dbe287e4e45d08ebc01e4d7a82150a78f9b59c91
sha1sums = 2c1112ec2901e83bed3f120ceb0597b53fc53cf6
sha1sums = c9e476f880a36dd7f1562547395547433da41022
sha1sums = 639e5c8e56999e56b0ae2348f3a11928fddca539
sha1sums = 46e148f221b54fe2b374e4f7201aa404378298b8
sha1sums = cb16065c67fb0697d63f9fd6c77fda673f9e5397
pkgname = collabora-online-server-nodocker

192
PKGBUILD Normal file
View File

@ -0,0 +1,192 @@
# Maintainer: Yves G. <theYinYeti@yalis.fr>
pkgname=collabora-online-server-nodocker
pkgver=2.1.4
pkgrel=1
pkgdesc="Collabora CODE (LibreOffice Online) server for Nextcloud or ownCloud, without Docker"
arch=('x86_64')
url="https://www.collaboraoffice.com/code/"
# see also: https://github.com/sfoxdev/docker-collabora-code
license=('MPL')
provides=('libreoffice' 'libreoffice-en-US')
optdepends=(
'hunspell-de: German hunspell dictionaries for LibreOffice'
'hunspell-en: English (US, UK, etc.) hunspell dictionaries for LibreOffice'
'hunspell-en_AU: AU English hunspell dictionaries for LibreOffice'
'hunspell-en_CA: CA English hunspell dictionaries for LibreOffice'
'hunspell-en_GB: GB English hunspell dictionaries for LibreOffice'
'hunspell-en_US: US English hunspell dictionaries for LibreOffice'
'hunspell-es: Spanish hunspell dictionaries for LibreOffice'
'hunspell-fr: French (modern) hunspell dictionaries for LibreOffice'
'hunspell-he: Hebrew hunspell dictionary for LibreOffice'
'hunspell-it: Italian dictionary for Hunspell for LibreOffice'
'hunspell-ro: Romanian dictionary for Hunspell for LibreOffice'
'hunspell-el: Greek hunspell dictionary for LibreOffice'
'hunspell-hu: Hungarian hunspell dictionary for LibreOffice'
'hunspell-nl: Dutch hunspell dictionaries for LibreOffice'
'hunspell-pl: Polish dictionary for Hunspell for LibreOffice'
'hyphen-de: German hyphenation rules for LibreOffice'
'hyphen-en: English hyphenation rules for LibreOffice'
'hyphen-es: Spanish hyphenation rules for LibreOffice'
'hyphen-fr: French hyphenation rules for LibreOffice'
'hyphen-it: Italian hyphenation rules for LibreOffice'
'hyphen-nl: Dutch hyphenation rules for LibreOffice'
'hyphen-ro: Romanian hyphenation rules for LibreOffice'
'hyphen-hu: Hungarian hyphenation rules for LibreOffice'
'hyphen-pl: Polish hyphenation rules for LibreOffice'
)
depends=()
source=(
'https://www.collaboraoffice.com/repos/CollaboraOnline/CODE/Packages'
install
mkcert_example.sh
nginx.conf
sysusers
tmpfiles
)
sha1sums=(
'fab66ee561bee5d004068c7c5090b70f91a9fb99'
'20e4371fe6f03e53684759a11260b71e0f844401'
'68ac242ad285eeeca07cb486c22dfbf3a658fe81'
'fe998836dbbd5c153de77d4ea877f25719dae304'
'2d271f9493ea14c675af1bfa76f6b654569dd51f'
'f9c102a06b2582548f13121e78790237e2cb38e1'
)
# From Debians conffiles
backup=(
opt/collaboraoffice5.3/share/psprint/psprint.conf
etc/loolwsd/loolkitconfig.xcu
etc/loolwsd/loolwsd.xml
)
# From Debians pre/post scripts
install=install
_upstream_deps='loolwsd code-brand'
_upstream_equiv='
adduser =
cpio =
fontconfig = fontconfig
init-system-helpers =
libc6 = gcc-libs
libcairo2 = cairo
libcap2 = libcap
libcap2-bin = libcap
libcups2 = libcups
libdbus-glib-1-2 = dbus-glib
libgcc1 = gcc-libs
libgl1-mesa-glx = mesa-libgl
libodbc1 = unixodbc
libpng12-0 = libpng12
libpococrypto48 = poco
libpocofoundation48 = poco
libpocojson48 = poco
libpoconet48 = poco
libpoconetssl48 = poco
libpocoutil48 = poco
libpocoxml48 = poco
libsm6 = libsm
libssl1.0.0 = openssl-1.0
libstdc++6 = gcc-libs
libxinerama1 = libxinerama
'
_upstream_handle_dep() {
local dep="$1"
local eqv="$(grep "^[[:blank:]]*$(sed 's/[.]/\\\0/g' <<<"$dep")[[:blank:]]*=" <<<"$_upstream_equiv")"
local meta="$(awk -F$'\n' -vRS= "/^Package:[[:blank:]]*$(sed 's/[.]/\\\0/g' <<<"$dep")\\n/{print}" Packages)"
local seen=
if [ -n "$eqv" ]; then
dep="$(sed 's/.*=[[:blank:]]*//' <<<"$eqv")"
[ -n "$dep" ] || return
for seen in "${depends[@]}"; do
[ "$seen" == "$dep" ] && return
done
depends[${#depends[*]}]="$dep"
elif [ -n "$meta" ]; then
dep="$(sed -rn "s#^Filename:[[:blank:]]*(.*/)?#${source[0]%Packages}#p" <<<"$meta")"
for seen in "${source[@]}"; do
[ "$seen" == "$dep" ] && return
done
source[${#source[*]}]="$dep"
sha1sums[${#sha1sums[*]}]="$(sed -rn "s#^SHA1:[[:blank:]]*##p" <<<"$meta")"
while read dep; do if [ -n "$dep" ]; then
_upstream_handle_dep "$dep"
fi; done < <(
sed -rn "s#^Depends:[[:blank:]]*##p" <<<"$meta" \
| sed 's#([^)]*)##g; s#[[:blank:]]*,[[:blank:]]*#\n#g'
)
else
echo "Unknown dependency: $dep" >&2; exit 1
fi
}
if [ ${#source[*]} -eq 6 ]; then
curl -s "${source[0]}" >Packages
pkgver=$(
awk -F$'\n' -vRS= '/^Package:[[:blank:]]*loolwsd\n/{print}' Packages \
| sed -n 's/^Version:[[:blank:]]*\(.*\)-.*/\1/p'
)
for dep in $_upstream_deps; do
_upstream_handle_dep "$dep"
done
fi
unset _upstream_handle_dep _upstream_equiv _upstream_deps
package() {
local data= f=
cd "$pkgdir"
for f in "$srcdir"/*.deb; do
data="$(ar t "$f" | grep ^data)"
case "$data" in
*.bz2) ar p "$f" "$data" | tar -xjf - ;;
*.gz) ar p "$f" "$data" | tar -xzf - ;;
*.xz) ar p "$f" "$data" | tar -xJf - ;;
*) echo "Unknown file format: $data" >&2; exit 1 ;;
esac
done
# /lib is deprecated
mv {lib,usr/lib}
# replace the too-generic “code-brand” name
mv usr/share/doc/code-brand usr/share/doc/lool-code-brand
# use systemd for user allocation
install -Dm0644 "$srcdir"/sysusers usr/lib/sysusers.d/$pkgname.conf
# replace cron with systemd
rm -rf etc/cron.d
install -Dm0644 "$srcdir"/tmpfiles usr/lib/tmpfiles.d/$pkgname.conf
# add dependency on systemd
sed -i '/^\[Unit\]/ a \
After=systemd-tmpfiles-setup.service' usr/lib/systemd/system/loolwsd.service
# keep the cert-making script from the Dockerfile for reference
install -Dm0644 "$srcdir"/mkcert_example.sh usr/share/doc/loolwsd/example.mkcert.sh
# actually provide libreoffice, without conflicting with Archlinux libreoffice
mkdir -p usr/share/applications
sed -i 's#^Exec=collaboraoffice5.3#Exec=/opt/collaboraoffice5.3/program/soffice#' \
opt/collaboraoffice5.3/share/xdg/*
ls opt/collaboraoffice5.3/share/xdg \
| while read f; do
case "$f" in
calc.desktop|draw.desktop|impress.desktop|writer.desktop)
sed -i "s#^Icon=.*#Icon=/opt/collaboraoffice5.3/share/config/wizard/web/images/${f%.desktop}.gif#" \
opt/collaboraoffice5.3/share/xdg/$f
;;
*)
sed -i 's#^Icon=.*#Icon=/opt/collaboraoffice5.3/share/config/wizard/web/images/other.gif#' \
opt/collaboraoffice5.3/share/xdg/$f
;;
esac
mv opt/collaboraoffice5.3/share/xdg/"$f" usr/share/applications/"collaboraoffice-$f"
done
rm -rf opt/collaboraoffice5.3/share/xdg
# give some hints about usage
install -Dm0644 "$srcdir"/nginx.conf usr/share/doc/loolwsd/example.nginx.conf
}

69
install Normal file
View File

@ -0,0 +1,69 @@
#!/bin/sh
post_install() {
## From Debian packages ##
setcap cap_fowner,cap_mknod,cap_sys_chroot=ep usr/bin/loolforkit || true
setcap cap_sys_admin=ep usr/bin/loolmount || true
systemd-sysusers collabora-online-server-nodocker.conf
chown lool:lool etc/loolwsd/loolwsd.xml
chmod 640 etc/loolwsd/loolwsd.xml
# We assume that the LibreOffice to be used is built TDF-style
# and installs in /opt/collaboraoffice5.3, and that /opt/lool is
# on the same file system
mkdir -p opt/lool/child-roots
chown -R lool:lool opt/lool
fc-cache opt/collaboraoffice5.3/share/fonts/truetype
su lool --shell=/bin/sh -c "loolwsd-systemplate-setup /opt/lool/systemplate /opt/collaboraoffice5.3 >/dev/null 2>&1"
## From Docker script ##
# Fix lool resolv.conf problem (wizdude)
[ -d opt/lool/systemplate/etc ] || mkdir -p opt/lool/systemplate/etc
rm -f opt/lool/systemplate/etc/resolv.conf
ln -s /etc/resolv.conf opt/lool/systemplate/etc/
chown lool:lool opt/lool
# Generate new SSL certificate instead of using the default
# Replace trusted host and set admin username and password
cat <<-THEEND
IMPORTANT!
IMPORTANT! A certificate must be issued if restricted HTTP access is not possible.
IMPORTANT! See /usr/share/doc/loolwsd/mkcert_example.sh for guidance.
IMPORTANT!
IMPORTANT! The username and password must be set in /etc/loolwsd/loolwsd.xml
IMPORTANT! for the admin console.
IMPORTANT!
IMPORTANT! In /etc/loolwsd/loolwsd.xml, the host should be set to a value
IMPORTANT! different than “localhost”.
IMPORTANT!
IMPORTANT! You may also want to force the server_name in /etc/loolwsd/loolwsd.xml.
IMPORTANT!
THEEND
post_upgrade
}
pre_upgrade() {
systemctl stop loolwsd.service
}
post_upgrade() {
systemctl daemon-reload
if systemctl list-unit-files loolwsd.service | grep -q 'enabled$'; then
systemctl start loolwsd.service
fi
}
pre_remove() {
pre_upgrade
}
post_remove() {
rm -rf /var/cache/loolwsd
rm -rf /opt/lool
}

21
mkcert_example.sh Normal file
View File

@ -0,0 +1,21 @@
#!/bin/sh
## Taken from the Dockerfile script
mkdir -p /opt/ssl/
cd /opt/ssl/
mkdir -p certs/ca
openssl genrsa -out certs/ca/root.key.pem 2048
openssl req -x509 -new -nodes -key certs/ca/root.key.pem -days 9131 -out certs/ca/root.crt.pem -subj "/C=DE/ST=BW/L=Stuttgart/O=Dummy Authority/CN=Dummy Authority"
mkdir -p certs/{servers,tmp}
mkdir -p "certs/servers/localhost"
openssl genrsa -out "certs/servers/localhost/privkey.pem" 2048 -key "certs/servers/localhost/privkey.pem"
if test "${cert_domain:-set}" == set; then
openssl req -key "certs/servers/localhost/privkey.pem" -new -sha256 -out "certs/tmp/localhost.csr.pem" -subj "/C=DE/ST=BW/L=Stuttgart/O=Dummy Authority/CN=localhost"
else
openssl req -key "certs/servers/localhost/privkey.pem" -new -sha256 -out "certs/tmp/localhost.csr.pem" -subj "/C=DE/ST=BW/L=Stuttgart/O=Dummy Authority/CN=${cert_domain}"
fi
openssl x509 -req -in certs/tmp/localhost.csr.pem -CA certs/ca/root.crt.pem -CAkey certs/ca/root.key.pem -CAcreateserial -out certs/servers/localhost/cert.pem -days 9131
mv certs/servers/localhost/privkey.pem /etc/loolwsd/key.pem
mv certs/servers/localhost/cert.pem /etc/loolwsd/cert.pem
mv certs/ca/root.crt.pem /etc/loolwsd/ca-chain.cert.pem

40
nginx.conf Normal file
View File

@ -0,0 +1,40 @@
# static files
location ^~ /loleaflet {
proxy_pass http://localhost:9980;
proxy_set_header Host $http_host;
}
# WOPI discovery URL
location ^~ /hosting/discovery {
proxy_pass http://localhost:9980;
proxy_set_header Host $http_host;
}
location ^~ /lool {
# this parent location makes sure that a global PHP catch-all
# wont pre-empt the first two child locations below
# main websocket
location ~ ^/lool/(.*)/ws$ {
proxy_pass http://localhost:9980;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "Upgrade";
proxy_set_header Host $http_host;
proxy_read_timeout 36000s;
}
# download, presentation and image upload
location ~ ^/lool {
proxy_pass http://localhost:9980;
proxy_set_header Host $http_host;
}
# Admin Console websocket
location ^~ /lool/adminws {
proxy_pass http://localhost:9980;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection "Upgrade";
proxy_set_header Host $http_host;
proxy_read_timeout 36000s;
}
}

2
sysusers Normal file
View File

@ -0,0 +1,2 @@
# Type Name ID GECOS Home
u lool - "LibreOffice OnLine" /opt/lool

2
tmpfiles Normal file
View File

@ -0,0 +1,2 @@
# Type Path Mode UID GID Age Argument
d /var/cache/loolwsd 6750 lool lool 10min