libreoffice-online/coolwsd.spec.in
Andras Timar 39e83470a8 Remove distro-specific code from rpm spec file
We'd like to build distro independent rpm packages.
Distro specific macros and other code were removed.
The empty environment file for systemd was removed, it can be
easily created by the user, if necessary.
The obsolete trigger for rebuilding the systemplate was removed,
because we no longer copy system libs to systemplate.

Signed-off-by: Andras Timar <andras.timar@collabora.com>
Change-Id: I0ac9be8f72a7089e38349abc1dff0d39b0410e44
2023-05-14 21:29:00 +02:00

141 lines
4.8 KiB
RPMSpec

# spec file for package coolwsd
#
# Copyright (c) 2023 Collabora
#
# 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/.
Name: coolwsd
Version: @PACKAGE_VERSION@
Release: 1
Vendor: Collabora Productivity Ltd.
Summary: Collabora Online WebSocket Daemon
License: EULA
Source0: coolwsd-@PACKAGE_VERSION@.tar.gz
BuildRequires: libcap-devel pam-devel gcc-c++ cppunit-devel pam-devel fontconfig make
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 /usr/bin/setcap /usr/bin/ssh-keygen
Provides: loolwsd
Obsoletes: loolwsd
%description
%prep
%setup -n coolwsd-@PACKAGE_VERSION@
%build
%configure \
--enable-silent-rules \
--with-lokit-path=bundled/include \
--with-lo-path=/opt/collaboraoffice \
--disable-setcap \
%if 0%{?config_options:1}
%{config_options}
%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}
install -D -m 444 coolwsd.service %{buildroot}/usr/lib/systemd/system/coolwsd.service
# Apache webserver on RH-like distributions
install -d -m 755 %{buildroot}/etc/httpd/conf
install -D -m 755 etc/apache2/coolwsd.conf %{buildroot}/etc/httpd/conf
mkdir -p %{buildroot}/etc/pam.d
echo "auth required pam_unix.so" > %{buildroot}/etc/pam.d/coolwsd
echo "account required pam_unix.so" >> %{buildroot}/etc/pam.d/coolwsd
%files
%defattr(-,root,root,-)
/usr/bin/coolwsd
/usr/bin/loolwsd
/usr/bin/coolwsd-systemplate-setup
/usr/bin/loolwsd-systemplate-setup
/usr/bin/coolwsd-generate-proof-key
/usr/bin/coolforkit
/usr/bin/coolconvert
/usr/bin/coolconfig
/usr/bin/loolconfig
/usr/bin/coolstress
/usr/bin/coolmount
/usr/share/coolwsd/discovery.xml
/usr/share/coolwsd/favicon.ico
/usr/share/coolwsd/browser
/usr/share/doc/coolwsd/README
/usr/share/doc/coolwsd/README.vars
/usr/share/doc/coolwsd/metrics.txt
/usr/share/doc/coolwsd/protocol.txt
/usr/share/doc/coolwsd/reference.md
/usr/share/man/man1/coolwsd.1.gz
/usr/share/man/man1/coolforkit.1.gz
/usr/share/man/man1/coolconvert.1.gz
/usr/share/man/man1/coolconfig.1.gz
/usr/share/man/man1/coolstress.1.gz
/usr/share/man/man1/coolwsd-systemplate-setup.1.gz
/usr/share/man/man1/coolwsd-generate-proof-key.1.gz
/usr/share/man/man1/coolmount.1.gz
/usr/lib/systemd/system/coolwsd.service
%config(noreplace) /etc/pam.d/coolwsd
%config(noreplace) %attr(640, cool, root) /etc/coolwsd/coolwsd.xml
%config /etc/coolwsd/coolkitconfig.xcu
%config(noreplace) /etc/nginx/snippets/coolwsd.conf
%config(noreplace) /etc/apache2/conf-available/coolwsd.conf
%config(noreplace) /etc/httpd/conf/coolwsd.conf
%doc README.md
%pre
getent group cool >/dev/null || groupadd -r cool
getent passwd cool >/dev/null || useradd -g cool -r cool -d /opt/cool -s /bin/bash
%post
setcap cap_fowner,cap_chown,cap_mknod,cap_sys_chroot=ep /usr/bin/coolforkit
setcap cap_sys_admin=ep /usr/bin/coolmount
if [ -f /etc/loolwsd/loolwsd.xml ]; then /usr/bin/coolconfig migrateconfig --write; fi
# systemd in RHEL 7 does not understand these options
if grep -q -F 'REDHAT_SUPPORT_PRODUCT_VERSION="7"' /etc/os-release; then
sed -i "/^ReadWritePaths/d;/^ProtectControlGroups/d;/^ProtectSystem/d" /usr/lib/systemd/system/coolwsd.service
fi
if [ $1 -eq 1 ] ; then
# Initial installation
systemctl preset coolwsd.service >/dev/null 2>&1 || :
fi
systemctl is-active -q coolwsd && COOLWSD_IS_ACTIVE=1 || COOLWSD_IS_ACTIVE=0
if [ $COOLWSD_IS_ACTIVE == "1" ]; then systemctl stop coolwsd; fi
# Figure out where LOKit is installed, let's hope it is not a mount point
# Create a directory for coolwsd on the same file system
lokitroot=/opt/collaboraoffice
coolparent=`cd ${lokitroot} && cd .. && /bin/pwd`
rm -rf ${coolparent}/cool
mkdir -p ${coolparent}/cool/child-roots
chown cool:cool ${coolparent}/cool
chown cool:cool ${coolparent}/cool/child-roots
fc-cache ${lokitroot}/share/fonts/truetype
coolwsd-systemplate-setup ${coolparent}/cool/systemplate ${lokitroot} >/dev/null 2>&1
coolwsd-generate-proof-key >/dev/null 2>&1
if [ $COOLWSD_IS_ACTIVE == "1" ]; then systemctl start coolwsd; fi
%preun
systemctl --no-reload disable coolwsd.service > /dev/null 2>&1 || :
systemctl stop coolwsd.service > /dev/null 2>&1 || :
%postun
systemctl daemon-reload >/dev/null 2>&1 || :
%changelog
* Mon Aug 03 2015 Mihai Varga
- added the cronjob
* Tue May 19 2015 Tor Lillqvist
- Initial RPM release