forked from CollaboraOnline/online
-
Notifications
You must be signed in to change notification settings - Fork 0
/
loolwsd.spec.in
224 lines (192 loc) · 7.46 KB
/
loolwsd.spec.in
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
# spec file for package loolwsd
#
# Copyright (c) 2015 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/.
%if 0%{?name_suffix:1}
Name: loolwsd%{name_suffix}
%else
Name: loolwsd
%endif
Version: @PACKAGE_VERSION@
Release: 1%{?dist}
Vendor: %{vendor}
Summary: Collabora Online WebSocket Daemon
License: EULA
Source0: loolwsd-@[email protected]
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
%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
%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
%endif
%if 0%{?name_suffix:1}
Provides: loleaflet = 1.5.8, loolwsd
%else
Provides: loleaflet = 1.5.8
%endif
Obsoletes: loleaflet <= 1.5.8
%description
%if 0%{?suse_version}
%debug_package
%endif
%prep
%setup -n loolwsd-@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 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
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
%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
%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/loolconfig
/usr/bin/loolmount
/usr/share/loolwsd/discovery.xml
/usr/share/loolwsd/favicon.ico
/usr/share/loolwsd/loleaflet
/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/loolconfig.1.gz
/usr/share/man/man1/loolwsd-systemplate-setup.1.gz
/usr/share/man/man1/loolwsd-generate-proof-key.1.gz
%{_unitdir}/loolwsd.service
%if 0%{?rhel}
%config(noreplace) /etc/sysconfig/loolwsd
%endif
%if 0%{?suse_version}
/var/adm/fillup-templates/sysconfig.loolwsd
%endif
%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
%pre
%if 0%{?suse_version}
%service_add_pre loolwsd.service
%endif
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
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
%systemd_post loolwsd.service
%else
%if 0%{?suse_version}
%service_add_post loolwsd.service
%{fillup_only -n loolwsd}
%endif
%endif
%preun
%if 0%{?rhel} >= 7
%systemd_preun loolwsd.service
%else
%if 0%{?suse_version}
%service_del_preun loolwsd.service
%endif
%endif
%postun
%if 0%{?rhel} >= 7
%systemd_postun loolwsd.service
%else
%if 0%{?suse_version}
%service_del_postun loolwsd.service
%endif
%endif
%changelog
* Mon Aug 03 2015 Mihai Varga
- added the cronjob
* Tue May 19 2015 Tor Lillqvist
- Initial RPM release