# The parts of the Ubuntu packages' maintainer scripts that change other packages' files
# or caches. Groups and directories come from sysusers.d/tmpfiles.d, the alternatives
# are symlinks in the package.

_fuse_allow_other() {
  # inuvika-ovd-regular-union-fs: profiles are mounted for the session user
  sed -ri 's/^# *(user_allow_other)/\1/' /etc/fuse.conf 2>/dev/null || :
}

post_install() {
  _fuse_allow_other
  update-desktop-database -q /usr/share/ovd-applications 2>/dev/null || :
  cat <<'MSG'
==> The services are not enabled. On an Application Server:
      systemctl enable ovd-slaveserver.service xrdp.service xrdp-sesman.service \
                       xrdp-log.service xrdp-printer.service
    The Session Manager address comes from the ovd.session_manager credential or
    session_manager in /etc/ovd/slaveserver/slaveserver.conf.
MSG
}

post_upgrade() {
  _fuse_allow_other
  update-desktop-database -q /usr/share/ovd-applications 2>/dev/null || :
}

pre_remove() {
  systemctl disable --now ovd-slaveserver.service xrdp.service xrdp-sesman.service \
    xrdp-printer.service xrdp-log.service >/dev/null 2>&1 || :
}
