#!/bin/bash

_USER_NAME=wmcuser

case $1 in
    configure)
        echo "Configure yandex-webmaster-xml-limits"

        # Create user if not existing
        if ! getent passwd ${_USER_NAME} >/dev/null 2>&1 ; then
            echo -n "Adding user ${_USER_NAME}... "
            useradd -u 360 -g nogroup -m -s /bin/bash ${_USER_NAME}
            echo "DONE"
        fi

        # Install dirs
        echo "Install dirs"

        _BINARY_FOLDER="/place/wmconsole/xml_limits"

        install -d -m 755 -o ${_USER_NAME} ${_BINARY_FOLDER}

        chown -RL ${_USER_NAME}:nogroup ${_BINARY_FOLDER}

        echo "DONE"
    ;;

    abort-upgrade|abort-remove|abort-deconfigure)
    ;;

    *)
        echo "postinst called with unknown argument \$1" >&2
    ;;
esac

exit 0
