#!/bin/sh

set -e

if [ "$1" = "configure" ]; then
  # Create the quxiote user
  if ! getent passwd quixote > /dev/null; then
    adduser --quiet --system --group --home /var/lib/quixote \
            --no-create-home \
            --gecos "Quixote web application daemon" \
            quixote
  fi

  # Verify ownership of var dir
  if ! dpkg-statoverride --list /var/lib/quixote >/dev/null; then
    chown quixote:quixote /var/lib/quixote
  fi
fi

#DEBHELPER#

exit 0
