post_install() {
  getent group lool > /dev/null || groupadd -r lool > /dev/null
  getent passwd lool > /dev/null || useradd -g lool lool > /dev/null
  post_upgrade
}

post_upgrade() {
  loolwsd-systemplate-setup /var/lib/lool/systemplate /usr/lib/libreoffice
  chown -R lool:lool /var/cache/loolwsd \
                     /var/lib/lool/child-roots \
                     /var/lib/lool/systemplate
  chmod u+w /var/lib/lool/child-roots
  setcap cap_fowner,cap_mknod,cap_sys_chroot=ep /usr/bin/loolforkit
  setcap cap_sys_admin=ep /usr/bin/loolmount
}

post_remove() {
   userdel -rf lool
   groupdel lool
   rm -r /var/lib/lool
}

