#!/usr/bin/env sh
set -eu

profile_parent="${TMPDIR:-/tmp}"
profile_dir="$(mktemp -d "${profile_parent%/}/easyflow-soffice-XXXXXX")"

cleanup() {
  rm -rf -- "$profile_dir"
}

trap cleanup EXIT HUP INT TERM

/usr/bin/soffice \
  -env:UserInstallation="file://${profile_dir}" \
  --headless \
  --safe-mode \
  --nologo \
  --nodefault \
  --nolockcheck \
  --norestore \
  "$@"
