forked from CollaboraOnline/online
-
Notifications
You must be signed in to change notification settings - Fork 0
/
coolwsd.spec.in
147 lines (125 loc) · 5.89 KB
/
coolwsd.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
# 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-@[email protected]
BuildRequires: libcap-devel pam-devel cppunit-devel nodejs rsync
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/sbin/setcap
Provides: loolwsd
Obsoletes: loolwsd collaboraoffice-dict-br collaboraoffice-dict-et collaboraoffice-dict-gd collaboraoffice-dict-gu collaboraoffice-dict-hi collaboraoffice-dict-lt collaboraoffice-dict-lv collaboraoffice-dict-ro collaboraoffice-dict-sr collaboraoffice-dict-te collaboraofficebasis-as collaboraofficebasis-bn-IN collaboraofficebasis-ast collaboraofficebasis-br collaboraofficebasis-ca-valencia collaboraofficebasis-cy collaboraofficebasis-et collaboraofficebasis-ga collaboraofficebasis-gd collaboraofficebasis-gu collaboraofficebasis-hi collaboraofficebasis-km collaboraofficebasis-kn collaboraofficebasis-lt collaboraofficebasis-lv collaboraofficebasis-ml collaboraofficebasis-mr collaboraofficebasis-nn collaboraofficebasis-or collaboraofficebasis-pa-IN collaboraofficebasis-ro collaboraofficebasis-sr collaboraofficebasis-sr-Latn collaboraofficebasis-ta collaboraofficebasis-te
%description
%prep
%setup -n coolwsd-@PACKAGE_VERSION@
%build
%configure \
--enable-silent-rules \
--with-lokit-path=bundled/include \
--with-lo-path=/opt/collaboraoffice \
--disable-setcap \
--disable-tests \
%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/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/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
# compatibility with older systemd versions
SYSTEMD_VERSION=$(busctl --system get-property org.freedesktop.systemd1 /org/freedesktop/systemd1 org.freedesktop.systemd1.Manager Version | grep -Eo [0-9]{3})
if [[ "$SYSTEMD_VERSION" -lt "228" ]]; then
sed -i "/^ProtectSystem/d" /usr/lib/systemd/system/coolwsd.service
fi
if [[ "$SYSTEMD_VERSION" -lt "231" ]]; then
sed -i "/^ReadWritePaths/d" /usr/lib/systemd/system/coolwsd.service
fi
if [[ "$SYSTEMD_VERSION" -lt "232" ]]; then
sed -i "/^ProtectControlGroups/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
coolconfig 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