blob: 4b011b283745e66fafc99ef623e0da5e489875b0 (
plain)
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
|
# Maintainer: Yves G. <theYinYeti@yalis.fr>
pkgname=collabora-online-server-nodocker
pkgver=4.0.1
pkgrel=1
pkgdesc="Collabora CODE (LibreOffice Online) server for Nextcloud or ownCloud, without Docker"
arch=('x86_64')
url="https://www.collaboraoffice.com/code/"
license=('MPL')
provides=('libreoffice' 'libreoffice-en-US')
makedepends=(bzip2 coreutils curl fontconfig gawk grep gzip libcap sed systemd tar util-linux xz)
# From Dockerfile’s install script, minus inotify-tools+psmisc: not actually part of CODE
depends=()
source=(
'https://www.collaboraoffice.com/repos/CollaboraOnline/CODE/Packages'
install
mkcert_example.sh
sysusers
tmpfiles
)
sha1sums=(
'SKIP'
'3b7c52a40becb96ed9698e624a23cadfe1250a73'
'132642655c8684a434ad2a43f1661020218cdfde'
'2d271f9493ea14c675af1bfa76f6b654569dd51f'
'f9c102a06b2582548f13121e78790237e2cb38e1'
)
# From deb’s conffiles
backup=(
opt/collaboraoffice6.0/share/psprint/psprint.conf
etc/apache2/conf-available/loolwsd.conf
etc/loolwsd/loolkitconfig.xcu
etc/loolwsd/loolwsd.xml
etc/nginx/snippets/loolwsd.conf
etc/sysconfig/loolwsd
)
# From deb’s pre/post scripts
install=install
# From Dockerfile (https://github.com/CollaboraOnline/Docker-CODE), minus i18n files
_upstream_deps='loolwsd code-brand'
# DEBIAN–ARCHLINUX EQUIVALENCES
#
# In case of a new upstream release:
#
# 1. Move all lines from $_upstream_equiv to $_upstream_equiv_OLD.
#
# 2. Run `makepkg -s` iteratively:
# * Each time a dependency is missing, move it back from $_upstream_equiv_OLD to $_upstream_equiv.
# * If a dependency is new, add a new line in $_upstream_equiv with nothing after the “=” sign.
#
# 3. When the package is done, in a terminal run: ./missing-deps.sh
#
# 4. For each “not found” line:
# * If the missing file should be provided by a new dependency in $_upstream_equiv,
# then put after the “=” sign the name of an Archlinux package that provides this file;
# you may need to create the package if it does not exist (usually old versions).
# * Else the missing file is probably expected to be present on any Debian/Ubuntu system;
# thus add the missing dependency in the $depends array.
_upstream_equiv='
adduser =
cpio = cpio
expat = expat
fontconfig = fontconfig
init-system-helpers =
libc6 = gcc-libs
libcap2 = libcap
libcap2-bin = libcap
libcups2 = libcups
libexpat1 =
libgcc1 = gcc-libs
libgl1-mesa-glx = mesa-libgl
libpam0g = pam
libpcre3 =
libpng12-0 = libpng12
libpococrypto60 = poco
libpocofoundation60 = poco
libpocojson60 = poco
libpoconet60 = poco
libpoconetssl60 = poco
libpocoutil60 = poco
libpocoxml60 = poco
libsm6 = libsm
libssl1.0.0 = openssl-1.0
libstdc++6 = gcc-libs
libxcb-render0 = libxcb
libxcb-shm0 = libxcb
libxinerama1 = libxinerama
libxrender1 = libxrender
locales-all = glibc
zlib1g = zlib
'
_upstream_equiv_OLD='
'
_upstream_handle_dep() {
local dep="$1"
local eqv="$(grep "^[[:blank:]]*$(sed 's/[.]/\\\0/g' <<<"$dep")[[:blank:]]*=" <<<"$_upstream_equiv")"
local meta="$(awk -F$'\n' -vRS= "/^Package:[[:blank:]]*$(sed 's/[.]/\\\0/g' <<<"$dep")\\n/{print}" Packages)"
local seen=
if [ -n "$eqv" ]; then
dep="$(sed 's/.*=[[:blank:]]*//' <<<"$eqv")"
[ -n "$dep" ] || return
for seen in "${depends[@]}"; do
[ "$seen" == "$dep" ] && return
done
if [[ "$dep" =~ :// ]]; then
source[${#source[*]}]="$dep"
sha1sums[${#sha1sums[*]}]="SKIP"
else
depends[${#depends[*]}]="$dep"
fi
elif [ -n "$meta" ]; then
dep="$(sed -rn "s#^Filename:[[:blank:]]*(.*/)?#${source[0]%Packages}#p" <<<"$meta")"
for seen in "${source[@]}"; do
[ "$seen" == "$dep" ] && return
done
source[${#source[*]}]="$dep"
sha1sums[${#sha1sums[*]}]="$(sed -rn "s#^SHA1:[[:blank:]]*##p" <<<"$meta")"
while read dep; do if [ -n "$dep" ]; then
_upstream_handle_dep "$dep"
fi; done < <(
sed -rn "s#^Depends:[[:blank:]]*##p" <<<"$meta" \
| sed 's#([^)]*)##g; s#[[:blank:]]*,[[:blank:]]*#\n#g'
)
else
echo "Unknown dependency: $dep" >&2; exit 1
fi
}
if [ ${#source[*]} -eq 5 ]; then
curl -s "${source[0]}" >Packages
pkgver=$(
awk -F$'\n' -vRS= '/^Package:[[:blank:]]*loolwsd\n/{print}' Packages \
| sed -n 's/^Version:[[:blank:]]*\(.*\)-.*/\1/p'
)
for dep in $_upstream_deps; do
_upstream_handle_dep "$dep"
done
fi
unset _upstream_handle_dep _upstream_equiv _upstream_deps
package() {
local data= f=
cd "$pkgdir"
for f in "$srcdir"/*.deb; do
data="$(ar t "$f" | grep ^data)"
case "$data" in
*.bz2) ar p "$f" "$data" | tar -xjf - ;;
*.gz) ar p "$f" "$data" | tar -xzf - ;;
*.xz) ar p "$f" "$data" | tar -xJf - ;;
*) echo "Unknown file format: $data" >&2; exit 1 ;;
esac
done
chown -R $(id -nu):$(id -ng) .
# /lib is deprecated
mv {lib,usr/lib}
# use systemd for user allocation
install -Dm0644 "$srcdir"/sysusers usr/lib/sysusers.d/$pkgname.conf
# replace cron with systemd
rm -rf etc/cron.d
install -Dm0644 "$srcdir"/tmpfiles usr/lib/tmpfiles.d/$pkgname.conf
# add dependency on systemd
sed -i '/^\[Unit\]/ a \
After=systemd-tmpfiles-setup.service' usr/lib/systemd/system/loolwsd.service
# keep the cert-making script from the Dockerfile for reference
install -Dm0644 "$srcdir"/mkcert_example.sh usr/share/doc/loolwsd/example.mkcert.sh
# actually provide libreoffice, without conflicting with Archlinux’ libreoffice
mkdir -p usr/share/applications
sed -i 's#^Exec=collaboraoffice6.0#Exec=/opt/collaboraoffice6.0/program/soffice#' \
opt/collaboraoffice6.0/share/xdg/*
ls -1 opt/collaboraoffice6.0/share/xdg \
| while read f; do
case "$f" in
base.desktop)
icon=/usr/share/loolwsd/loleaflet/dist/images/lc_basicshapes.can.svg ;;
calc.desktop)
icon=/usr/share/loolwsd/loleaflet/dist/images/x-office-spreadsheet.svg ;;
draw.desktop)
icon=/usr/share/loolwsd/loleaflet/dist/images/lc_gallery.svg ;;
impress.desktop)
icon=/usr/share/loolwsd/loleaflet/dist/images/x-office-presentation.svg ;;
math.desktop)
icon=/usr/share/loolwsd/loleaflet/dist/images/lc_symbolshapes.brace-pair.svg ;;
writer.desktop)
icon=/usr/share/loolwsd/loleaflet/dist/images/x-office-document.svg ;;
*)
icon=/usr/share/loolwsd/loleaflet/dist/images/toolbar-bg.svg ;;
esac
sed -i "s#^Icon=.*#Icon=${icon}#" opt/collaboraoffice6.0/share/xdg/"$f"
mv opt/collaboraoffice6.0/share/xdg/"$f" usr/share/applications/"collaboraoffice-$f"
done
rm -rf opt/collaboraoffice6.0/share/xdg
# https://github.com/CollaboraOnline/Docker-CODE/issues/32
[ -d etc/sysconfig ] || mkdir etc/sysconfig
echo 'SLEEPFORDEBUGGER=0' >>etc/sysconfig/loolwsd
}
|