libreoffice-online/loolwsd.spec.in

219 lines
7.3 KiB
RPMSpec
Raw Normal View History

# spec file for package loolwsd
#
# Copyright (c) 2015 Collabora
#
2016-04-21 03:14:17 -05:00
# This file is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
2016-08-04 18:15:33 -05:00
%if 0%{?name_suffix:1}
Name: loolwsd%{name_suffix}
%else
Name: loolwsd
2016-08-04 18:15:33 -05:00
%endif
Version: @PACKAGE_VERSION@
Release: 1%{?dist}
Vendor: %{vendor}
Summary: Collabora Online WebSocket Daemon
License: EULA
Source0: loolwsd-@PACKAGE_VERSION@.tar.gz
BuildRequires: libcap-devel libpng-devel pam-devel gcc-c++ cppunit-devel pam-devel fontconfig make
# Red Hat and CentOS
%if 0%{?rhel} == 7
BuildRequires: libpcap kernel-headers python36-polib python36-lxml
%endif
%if 0%{?rhel} == 8
BuildRequires: libpcap kernel-headers python3-polib python3-lxml
2016-04-21 03:14:17 -05:00
%endif
# openSUSE Leap 15.x, SLES12, SLES15
%if 0%{?suse_version}
BuildRequires: libcap-progs linux-glibc-devel systemd-rpm-macros python3-polib python3-lxml
%endif
Requires: collaboraoffice collaboraoffice-ure collaboraofficebasis-core collaboraofficebasis-writer collaboraofficebasis-impress collaboraofficebasis-graphicfilter collaboraofficebasis-en-US collaboraofficebasis-calc collaboraofficebasis-ooofonts collaboraofficebasis-images collaboraofficebasis-draw collaboraofficebasis-extension-pdf-import collaboraofficebasis-ooolinguistic collaboraofficebasis-math
Requires(post): coreutils grep sed cpio
%if 0%{?rhel}
# loolwsd dependencies
Requires: systemd expat keyutils-libs krb5-libs libattr libcap libcom_err libgcc libpng libselinux openssh-clients openssl-libs pcre xz-libs zlib
# Collabora Office dependencies (unfortunately Collabora Office RPM packages do not have real dependencies)
Requires: expat fontconfig freetype libuuid bzip2-libs
%endif
2016-04-21 03:14:17 -05:00
%if 0%{?suse_version}
# loolwsd dependencies
Requires(post): libcap-progs
Requires: systemd libopenssl1_0_0 libpcre1 libz1 libcap2 libpng12-0 %{fillup_prereq}
# Collabora Office dependencies (unfortunately Collabora Office RPM packages do not have real dependencies)
# cd /opt/collaboraoffice/program ; for i in soffice.bin *.so ;do ldd $i | grep '=>' | sed -e "s/^.*=> //" -e "s/ [(].*$//"; done | sort | uniq | xargs rpm -qf --qf="%{NAME}\n" | sort | uniq | grep -v collaboraoffice
Requires: fontconfig libbz2-1 libexpat1 libfreetype6 libpng16-16 libuuid1 openssh
2016-04-21 03:14:17 -05:00
%endif
%description
%if 0%{?suse_version}
2016-10-28 12:32:07 -05:00
%debug_package
%endif
%prep
2016-08-04 18:15:33 -05:00
%setup -n loolwsd-@PACKAGE_VERSION@
%build
2016-04-08 04:24:52 -05:00
%configure \
--enable-silent-rules \
2016-04-08 04:24:52 -05:00
--with-lokit-path=bundled/include \
--with-lo-path=/opt/collaboraoffice \
--disable-setcap \
2016-08-05 06:26:52 -05:00
%if 0%{?config_options:1}
%{config_options}
2016-04-08 04:24:52 -05:00
%endif
env BUILDING_FROM_RPMBUILD=yes make %{?_smp_mflags}
%check
#env BUILDING_FROM_RPMBUILD=yes make check
%install
env BUILDING_FROM_RPMBUILD=yes make install DESTDIR=%{buildroot}
2015-06-01 11:53:29 -05:00
install -d -m 755 %{buildroot}/var/adm/fillup-templates
%if 0%{?rhel}
install -D -m 444 loolwsd.service %{buildroot}%{_unitdir}/loolwsd.service
# systemd in RHEL 7 does not understand these options
%if 0%{?rhel} <= 7
sed -i "/^ReadWritePaths/d;/^ProtectControlGroups/d;/^ProtectSystem/d" %{buildroot}%{_unitdir}/loolwsd.service
%endif
2016-04-21 03:14:17 -05:00
install -D -m 644 sysconfig.loolwsd %{buildroot}/etc/sysconfig/loolwsd
install -d -m 755 %{buildroot}/etc/httpd/conf
install -D -m 755 etc/apache2/loolwsd.conf %{buildroot}/etc/httpd/conf
rm %{buildroot}/etc/apache2/conf-available/loolwsd.conf
%endif
2016-04-21 03:14:17 -05:00
%if 0%{?suse_version}
install -D -m 444 loolwsd.service %{buildroot}%{_unitdir}/loolwsd.service
install -D -m 644 sysconfig.loolwsd %{buildroot}/var/adm/fillup-templates
2016-04-21 03:14:17 -05:00
%endif
mkdir -p %{buildroot}/etc/pam.d
echo "auth required pam_unix.so" > %{buildroot}/etc/pam.d/loolwsd
echo "account required pam_unix.so" >> %{buildroot}/etc/pam.d/loolwsd
%files
%defattr(-,root,root,-)
/usr/bin/loolwsd
/usr/bin/loolwsd-systemplate-setup
/usr/bin/loolwsd-generate-proof-key
/usr/bin/loolforkit
/usr/bin/loolconvert
/usr/bin/coolconfig
wsd: faster jail setup via bind-mount loolmount now works and supports mounting and unmounting, plus numerous improvements, refactoring, logging, etc.. When enabled, binding improves the jail setup time by anywhere from 2x to orders of magnitude (in docker, f.e.). A new config entry mount_jail_tree controls whether mounting is used or the old method of linking/copying of jail contents. It is set to true by default and falls back to linking/copying. A test mount is done when the setting is enabled, and if mounting fails, it's disabled to avoid noise. Temporarily disabled for unit-tests until we can cleanup lingering mounts after Jenkins aborts our build job. In a future patch we will have mount/jail cleanup as part of make. The network/system files in /etc that need frequent refreshing are now updated in systemplate to make their most recent version available in the jails. These files can change during the course of loolwsd lifetime, and are unlikely to be updated in systemplate after installation at all. We link to them in the systemplate/etc directory, and if that fails, we copy them before forking each kit instance to have the latest. This reworks the approach used to bind-mount the jails and the templates such that the total is now down to only three mounts: systemplate, lo, tmp. As now systemplate and lotemplate are shared, they must be mounted as readonly, this means that user/ must now be moved into tmp/user/ which is writable. The mount-points must be recursive, because we mount lo/ within the mount-point of systemplate (which is the root of the jail). But because we (re)bind recursively, and because both systemplate and lotemplate are mounted for each jails, we need to make them unbindable, so they wouldn't multiply the mount-points for each jails (an explosive growth!) Contrarywise, we don't want the mount-points to be shared, because we don't expect to add/remove mounts after a jail is created. The random temp directory is now created and set correctly, plus many logging and other improvements. Change-Id: Iae3fda5e876cf47d2cae6669a87b5b826a8748df Reviewed-on: https://gerrit.libreoffice.org/c/online/+/92829 Tested-by: Jenkins Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice@gmail.com> Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
2020-04-09 08:02:58 -05:00
/usr/bin/loolmount
/usr/share/loolwsd/discovery.xml
/usr/share/loolwsd/favicon.ico
/usr/share/loolwsd/browser
/usr/share/doc/loolwsd/README
/usr/share/doc/loolwsd/README.vars
/usr/share/doc/loolwsd/metrics.txt
/usr/share/doc/loolwsd/protocol.txt
/usr/share/doc/loolwsd/reference.md
/usr/share/man/man1/loolwsd.1.gz
/usr/share/man/man1/loolforkit.1.gz
/usr/share/man/man1/loolconvert.1.gz
/usr/share/man/man1/coolconfig.1.gz
/usr/share/man/man1/loolwsd-systemplate-setup.1.gz
/usr/share/man/man1/loolwsd-generate-proof-key.1.gz
/usr/share/man/man1/loolmount.1.gz
2015-06-01 11:53:29 -05:00
%{_unitdir}/loolwsd.service
%if 0%{?rhel}
2016-04-21 03:14:17 -05:00
%config(noreplace) /etc/sysconfig/loolwsd
%endif
2016-04-21 03:14:17 -05:00
%if 0%{?suse_version}
2015-06-01 11:53:29 -05:00
/var/adm/fillup-templates/sysconfig.loolwsd
2016-04-21 03:14:17 -05:00
%endif
2016-04-14 08:14:59 -05:00
%config(noreplace) /etc/pam.d/loolwsd
%config(noreplace) %attr(640, lool, root) /etc/loolwsd/loolwsd.xml
%config /etc/loolwsd/loolkitconfig.xcu
%config(noreplace) /etc/nginx/snippets/loolwsd.conf
%if 0%{?suse_version} > 0
%config(noreplace) /etc/apache2/conf-available/loolwsd.conf
%endif
%if 0%{?rhel} > 0
%config(noreplace) /etc/httpd/conf/loolwsd.conf
%endif
%doc README.md
2015-06-01 11:53:29 -05:00
%pre
2016-04-21 03:14:17 -05:00
%if 0%{?suse_version}
2015-06-01 11:53:29 -05:00
%service_add_pre loolwsd.service
2016-04-21 03:14:17 -05:00
%endif
2015-06-01 11:53:29 -05:00
2016-04-21 03:14:17 -05:00
getent group lool >/dev/null || groupadd -r lool
getent passwd lool >/dev/null || useradd -g lool -r lool -d /opt/lool -s /bin/bash
# for filename in `find /opt/lool/systemplate -type f`;do stripped=$(echo -ne $filename | sed -e "s|/opt/lool/systemplate||");rpm -qf --qf="%{NAME}\n" $stripped;done | grep -v devel | grep -v 32bit | grep -v -- -fonts | sort | uniq
%triggerin -- expat fontconfig freetype freetype2 glibc glibc-locale kernel keyutils-libs krb5 krb5-libs libbz2-1 libcap libcap-ng libcap2 libexpat1 libfreetype6 libgcc libgcc_s1 libgcrypt libiscsi libpng libpng12 libpng12-0 libpng15-15 libpng16-16 libstdc++ libstdc++6 libuuid libuuid1 libz1 lsb nss-mdns nss-softokn-freebl pcre sssd sssd-client systemd-libs timezone tzdata zlib
echo -ne "Triggered update of loolwsd systemplate..."
%if 0%{?rhel} >= 7 || 0%{?suse_version} >= 1300
systemctl is-active -q loolwsd && LOOLWSD_IS_ACTIVE=1 || LOOLWSD_IS_ACTIVE=0
if [ $LOOLWSD_IS_ACTIVE == "1" ]; then systemctl stop loolwsd; fi
%endif
# Figure out where LO is installed, let's hope it is not a mount point
# Create a directory for loolwsd on the same file system
loroot=/opt/collaboraoffice
loolparent=`cd ${loroot} && cd .. && /bin/pwd`
rm -rf ${loolparent}/lool
mkdir -p ${loolparent}/lool/child-roots
2016-04-21 03:14:17 -05:00
chown lool:lool ${loolparent}/lool
chown lool:lool ${loolparent}/lool/child-roots
fc-cache ${loroot}/share/fonts/truetype
loolwsd-systemplate-setup ${loolparent}/lool/systemplate ${loroot} >/dev/null 2>&1
loolwsd-generate-proof-key >/dev/null 2>&1
%if 0%{?rhel} || 0%{?suse_version}
if [ $LOOLWSD_IS_ACTIVE == "1" ]; then systemctl start loolwsd; fi
%endif
echo " Done."
%post
setcap cap_fowner,cap_chown,cap_mknod,cap_sys_chroot=ep /usr/bin/loolforkit
setcap cap_sys_admin=ep /usr/bin/loolmount
%if 0%{?rhel} >= 7
2016-04-21 03:14:17 -05:00
%systemd_post loolwsd.service
%else
%if 0%{?suse_version}
2015-06-01 11:53:29 -05:00
%service_add_post loolwsd.service
%{fillup_only -n loolwsd}
2016-04-21 03:14:17 -05:00
%endif
%endif
2015-06-01 11:53:29 -05:00
%preun
%if 0%{?rhel} >= 7
2016-04-21 03:14:17 -05:00
%systemd_preun loolwsd.service
%else
%if 0%{?suse_version}
2015-06-01 11:53:29 -05:00
%service_del_preun loolwsd.service
2016-04-21 03:14:17 -05:00
%endif
%endif
2015-06-01 11:53:29 -05:00
%postun
%if 0%{?rhel} >= 7
2016-04-21 03:14:17 -05:00
%systemd_postun loolwsd.service
%else
%if 0%{?suse_version}
2015-06-01 11:53:29 -05:00
%service_del_postun loolwsd.service
2016-04-21 03:14:17 -05:00
%endif
%endif
2015-06-01 11:53:29 -05:00
%changelog
2015-08-03 14:01:11 -05:00
* Mon Aug 03 2015 Mihai Varga
- added the cronjob
* Tue May 19 2015 Tor Lillqvist
- Initial RPM release