libreoffice-online/debian/coolwsd.postinst.in
Michael Meeks 144b701453 cool#8703 - Drop random node creation and rely on inherited fd.
Re-using an inherited file descriptor to /dev/urandom frees us
from problems with mount options including 'nodev' and removes a
capability from the set we need.

Change-Id: I70337e923f802d7efbd3159c11a4e39f6529b6e6
Signed-off-by: Michael Meeks <michael.meeks@collabora.com>
2024-04-07 12:11:48 +02:00

36 lines
1 KiB
Bash

#!/bin/sh
set -e
case "$1" in
configure)
setcap cap_fowner,cap_chown,cap_sys_chroot=ep /usr/bin/coolforkit || true
setcap cap_sys_admin=ep /usr/bin/coolmount || true
if [ -f /etc/loolwsd/loolwsd.xml ]; then /usr/bin/coolconfig migrateconfig --write || true; fi
adduser --quiet --system --group --home /opt/cool cool
chown cool: /etc/coolwsd/coolwsd.xml
chmod 640 /etc/coolwsd/coolwsd.xml
# We assume that the LibreOffice to be used is built TDF-style
# and installs in @LO_PATH@, and that /opt/cool is
# on the same file system
rm -rf /opt/cool
mkdir -p /opt/cool/child-roots
chown cool: /opt/cool
chown cool: /opt/cool/child-roots
fc-cache @LO_PATH@/share/fonts/truetype
coolwsd-systemplate-setup /opt/cool/systemplate @LO_PATH@ >/dev/null 2>&1
coolconfig generate-proof-key >/dev/null 2>&1
cat << EOF > /etc/apt/apt.conf.d/25coolwsd
// Rebuild systemplate of @APP_NAME@
DPkg::Post-Invoke { "echo Updating coolwsd systemplate;coolwsd-systemplate-setup /opt/cool/systemplate @LO_PATH@ >/dev/null 2>&1 || true"; };
EOF
;;
esac
#DEBHELPER#