#!/bin/sh
set -e

case "$1" in
    configure)
        if [ -d /run/systemd/system ] && [ -x /usr/bin/systemd-sysusers ]; then
            systemd-sysusers oauth2-proxy.conf
        else
            if ! getent passwd oauth2-proxy >/dev/null; then
                adduser --system --group --no-create-home --home /nonexistent \
                    --gecos "OAuth2 Proxy Service" oauth2-proxy
            fi
        fi
        ;;
esac

#DEBHELPER#

exit 0
