libreoffice-online/debian/loolwsd.postinst.in
Andras Timar 85bda6dc11 deb: compatibility with older systemd versions
Signed-off-by: Andras Timar <andras.timar@collabora.com>
Change-Id: I3a4b168cb72ff400cd6b921f0305808eef0420d9
2021-05-17 15:50:02 +02:00

47 lines
1.5 KiB
Bash

#!/bin/sh
set -e
case "$1" in
configure)
setcap cap_fowner,cap_chown,cap_mknod,cap_sys_chroot=ep /usr/bin/loolforkit || true
setcap cap_sys_admin=ep /usr/bin/loolmount || true
adduser --quiet --system --group --home /opt/lool lool
chown lool: /etc/loolwsd/loolwsd.xml
chmod 640 /etc/loolwsd/loolwsd.xml
# We assume that the LibreOffice to be used is built TDF-style
# and installs in @LO_PATH@, and that /opt/lool is
# on the same file system
rm -rf /opt/lool
mkdir -p /opt/lool/child-roots
chown lool: /opt/lool
chown lool: /opt/lool/child-roots
fc-cache @LO_PATH@/share/fonts/truetype
# 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" /lib/systemd/system/loolwsd.service
fi
if [[ "$SYSTEMD_VERSION" -lt "231" ]]; then
sed -i "/^ReadWritePaths/d" /lib/systemd/system/loolwsd.service
fi
if [[ "$SYSTEMD_VERSION" -lt "232" ]]; then
sed -i "/^ProtectControlGroups/d" /lib/systemd/system/loolwsd.service
fi
loolwsd-systemplate-setup /opt/lool/systemplate @LO_PATH@ >/dev/null 2>&1
loolwsd-generate-proof-key >/dev/null 2>&1
cat << EOF > /etc/apt/apt.conf.d/25loolwsd
// Rebuild systemplate of @APP_NAME@
DPkg::Post-Invoke { "echo Updating loolwsd systemplate;loolwsd-systemplate-setup /opt/lool/systemplate @LO_PATH@ >/dev/null 2>&1"; };
EOF
;;
esac
#DEBHELPER#