#! /bin/sh

set -e

if ! grep -q '^pkspxy:' /etc/passwd
then
    adduser --system --home /var/cache/pkspxy --ingroup nogroup \
            --disabled-password pkspxy > /dev/null 2>&1
    # give the user a shell, otherwise "su pkspxy -c ..." does not work:
    chsh -s /bin/sh pkspxy
fi

if ! [ -d /var/cache/pkspxy/0 ]
then
    # create cache directory:
    /usr/sbin/pkspxy -c 2> /dev/null || true
fi

chown -R pkspxy.root /var/cache/pkspxy

#DEBHELPER#
