#!/bin/sh

NAME=barbacompta
MANAGE="/usr/lib/$NAME/manage.py"

# load configuration
export BARBACOMPTA_SETTINGS_FILE=/etc/$NAME/config.py

# check user
if test x$1 = x"--forceuser"
then
    shift
elif test $(id -un) != "$NAME"
then
    echo "error: must use $0 with user ${NAME}"
    exit 1
fi

if test $# -eq 0
then
    python3 ${MANAGE} help
    exit 1
fi

python3 ${MANAGE} "$@"
