2015-08-06 12:01:06 -05:00
|
|
|
#!/bin/sh
|
|
|
|
|
|
|
|
set -e
|
|
|
|
|
|
|
|
case "$1" in
|
|
|
|
configure)
|
2021-01-04 05:49:58 -06:00
|
|
|
setcap cap_fowner,cap_chown,cap_mknod,cap_sys_chroot=ep /usr/bin/loolforkit || true
|
wsd: faster jail setup via bind-mount
loolmount now works and supports mounting and
unmounting, plus numerous improvements,
refactoring, logging, etc.. When enabled,
binding improves the jail setup time by anywhere
from 2x to orders of magnitude (in docker, f.e.).
A new config entry mount_jail_tree controls
whether mounting is used or the old method of
linking/copying of jail contents. It is set to
true by default and falls back to linking/copying.
A test mount is done when the setting is enabled,
and if mounting fails, it's disabled to avoid noise.
Temporarily disabled for unit-tests until we can
cleanup lingering mounts after Jenkins aborts our
build job. In a future patch we will have mount/jail
cleanup as part of make.
The network/system files in /etc that need frequent
refreshing are now updated in systemplate to make
their most recent version available in the jails.
These files can change during the course of loolwsd
lifetime, and are unlikely to be updated in
systemplate after installation at all. We link to
them in the systemplate/etc directory, and if that
fails, we copy them before forking each kit
instance to have the latest.
This reworks the approach used to bind-mount the
jails and the templates such that the total is
now down to only three mounts: systemplate, lo, tmp.
As now systemplate and lotemplate are shared, they
must be mounted as readonly, this means that user/
must now be moved into tmp/user/ which is writable.
The mount-points must be recursive, because we mount
lo/ within the mount-point of systemplate (which is
the root of the jail). But because we (re)bind
recursively, and because both systemplate and
lotemplate are mounted for each jails, we need to
make them unbindable, so they wouldn't multiply the
mount-points for each jails (an explosive growth!)
Contrarywise, we don't want the mount-points to
be shared, because we don't expect to add/remove
mounts after a jail is created.
The random temp directory is now created and set
correctly, plus many logging and other improvements.
Change-Id: Iae3fda5e876cf47d2cae6669a87b5b826a8748df
Reviewed-on: https://gerrit.libreoffice.org/c/online/+/92829
Tested-by: Jenkins
Tested-by: Jenkins CollaboraOffice <jenkinscollaboraoffice@gmail.com>
Reviewed-by: Ashod Nakashian <ashnakash@gmail.com>
2020-04-09 08:02:58 -05:00
|
|
|
setcap cap_sys_admin=ep /usr/bin/loolmount || true
|
2015-08-06 12:01:06 -05:00
|
|
|
|
|
|
|
adduser --quiet --system --group --home /opt/lool lool
|
2016-01-08 02:24:47 -06:00
|
|
|
mkdir -p /var/cache/loolwsd && chown lool: /var/cache/loolwsd
|
2016-01-08 02:11:58 -06:00
|
|
|
rm -rf /var/cache/loolwsd/*
|
2019-05-22 03:41:25 -05:00
|
|
|
chown lool: /etc/loolwsd/loolwsd.xml
|
|
|
|
chmod 640 /etc/loolwsd/loolwsd.xml
|
2015-08-06 12:01:06 -05:00
|
|
|
|
|
|
|
# We assume that the LibreOffice to be used is built TDF-style
|
2017-03-20 17:22:26 -05:00
|
|
|
# and installs in @LO_PATH@, and that /opt/lool is
|
2015-08-06 12:01:06 -05:00
|
|
|
# on the same file system
|
|
|
|
|
2016-01-08 02:22:28 -06:00
|
|
|
rm -rf /opt/lool
|
2015-08-06 12:01:06 -05:00
|
|
|
mkdir -p /opt/lool/child-roots
|
2016-01-08 02:24:47 -06:00
|
|
|
chown lool: /opt/lool
|
|
|
|
chown lool: /opt/lool/child-roots
|
2015-08-06 12:01:06 -05:00
|
|
|
|
2017-04-04 05:12:22 -05:00
|
|
|
fc-cache @LO_PATH@/share/fonts/truetype
|
|
|
|
|
2019-02-05 13:55:57 -06:00
|
|
|
loolwsd-systemplate-setup /opt/lool/systemplate @LO_PATH@ >/dev/null 2>&1
|
2020-04-23 08:55:32 -05:00
|
|
|
loolwsd-generate-proof-key >/dev/null 2>&1
|
2019-11-26 15:56:58 -06:00
|
|
|
cat << EOF > /etc/apt/apt.conf.d/25loolwsd
|
2019-11-27 05:15:52 -06:00
|
|
|
// Rebuild systemplate of @APP_NAME@
|
2020-07-05 02:01:50 -05:00
|
|
|
DPkg::Post-Invoke { "echo Updating loolwsd systemplate;loolwsd-systemplate-setup /opt/lool/systemplate @LO_PATH@ >/dev/null 2>&1"; };
|
2019-11-26 15:56:58 -06:00
|
|
|
EOF
|
2015-08-06 12:01:06 -05:00
|
|
|
;;
|
|
|
|
|
|
|
|
esac
|
|
|
|
|
2016-09-25 12:18:38 -05:00
|
|
|
#DEBHELPER#
|