libreoffice-online/loolwsd/loolwsd.spec.in
2016-01-05 14:33:11 +01:00

104 lines
4.2 KiB
RPMSpec

#
# spec file for package loolwsd
#
# Copyright (c) 2015 Collabora
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
# upon. The license for this file, and modifications and additions to the
# file, is the same license as for the pristine package itself (unless the
# license for the pristine package is not an Open Source License, in which
# case the license is the MIT License). An "Open Source License" is a
# license that conforms to the Open Source Definition (Version 1.9)
# published by the Open Source Initiative.
# See also http://en.opensuse.org/openSUSE:Specfile_guidelines
Name: loolwsd
Version: @PACKAGE_VERSION@
Release: 0
Vendor: Collabora
Summary: LibreOffice On-Line WebSocket Daemon
License: MPL
Source0: loolwsd-@PACKAGE_VERSION@.tar.gz
BuildRequires: libcap-progs libcap-devel libpng-devel poco-devel >= 1.6.0 systemd-rpm-macros
# This works for now only with a CP build of 5.0, I think. The TDF
# (and thus also CP) packages include the version number in their
# names. How clever is that? So we need to specify one.
Requires: libcap libcap-progs libpng libPocoFoundation30 >= 1.6.0 libPocoNet30 >= 1.6.0 collaboraoffice5.0 collaboraoffice5.0-en-US collaboraoffice5.0-ure collaboraofficebasis5.0-core collaboraofficebasis5.0-writer collaboraofficebasis5.0-impress collaboraofficebasis5.0-graphicfilter collaboraofficebasis5.0-en-US collaboraofficebasis5.0-calc collaboraofficebasis5.0-en-US-res collaboraofficebasis5.0-en-US-calc collaboraofficebasis5.0-ooofonts collaboraofficebasis5.0-images collaboraofficebasis5.0-filter-data collaboraofficebasis5.0-draw collaboraofficebasis5.0-base collaboraofficebasis5.0-en-US-writer collaboraofficebasis5.0-en-US-math collaboraofficebasis5.0-en-US-base Mesa-libEGL1 Mesa-libGL1 Mesa-libglapi0 cups-libs dbus-1-glib fontconfig libbz2-1 libcairo2 libdrm2 libexpat1 libfreetype6 libgbm1 libgio-2_0-0 libglib-2_0-0 libgmodule-2_0-0 libgobject-2_0-0 libgthread-2_0-0 liblzma5 libpcre1 libpixman-1-0 libpng16-16 libuuid1 libxml2-2 %{?systemd_requires} %{fillup_prereq}
%define owner lool
%define group lool
%description
%prep
%setup -q
%build
%configure --with-lokit-path=bundled/include
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}
%__install -D -m 444 loolwsd.service %{buildroot}%{_unitdir}/loolwsd.service
install -d -m 755 %{buildroot}/var/adm/fillup-templates
install -D -m 644 sysconfig.loolwsd %{buildroot}/var/adm/fillup-templates
mkdir -p %{buildroot}/etc/cron.d
echo "#Remove old tiles once every 10 days at midnight" > %{buildroot}/etc/cron.d/loolwsd.cron
echo "0 0 */1 * * root find /var/cache/loolwsd -name \"*.png\" -a -atime +10 -exec rm {} \;" >> %{buildroot}/etc/cron.d/loolwsd.cron
%files
/usr/bin/loolwsd
/usr/bin/loolwsd-systemplate-setup
%{_unitdir}/loolwsd.service
/var/adm/fillup-templates/sysconfig.loolwsd
/etc/cron.d/loolwsd.cron
%doc README
%pre
%service_add_pre loolwsd.service
%post
setcap cap_fowner,cap_mknod,cap_sys_chroot=ep /usr/bin/loolwsd
setcap cap_fowner,cap_mknod,cap_sys_chroot=ep /usr/bin/loolbroker
getent group %{group} >/dev/null || groupadd -r %{group}
getent passwd %{owner} >/dev/null || useradd -g %{group} -r %{owner}
mkdir -p /var/cache/loolwsd && chmod og+w /var/cache/loolwsd
# 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=`rpm -ql collaboraoffice5.0 | grep '/soffice$' | sed -e 's-/program/soffice--'`
loolparent=`cd ${loroot} && cd .. && /bin/pwd`
rm -rf ${loolparent}/lool
mkdir -p ${loolparent}/lool/child-roots
chown %{owner} ${loolparent}/lool
chown %{owner} ${loolparent}/lool/child-roots
su %{owner} -c "loolwsd-systemplate-setup ${loolparent}/lool/systemplate ${loroot} >/dev/null"
%service_add_post loolwsd.service
%{fillup_only -n loolwsd}
%preun
%service_del_preun loolwsd.service
%postun
%service_del_postun loolwsd.service
%changelog
* Mon Aug 03 2015 Mihai Varga
- added the cronjob
* Tue May 19 2015 Tor Lillqvist
- Initial RPM release