#!/bin/sh
# This is the post installation script for globaleaks
set -e

# Create globaleaks user and add the user to required groups
if ! id -u globaleaks >/dev/null 2>&1; then
  adduser --quiet \
          --system \
	  --group \
          --disabled-login \
          --disabled-password \
          --home /var/globaleaks \
          --shell /bin/false \
          globaleaks
fi

if [ ! -d "/var/globaleaks" ]; then
    mkdir -m 700 /var/globaleaks && chown globaleaks:globaleaks /var/globaleaks
fi

usermod -a -G debian-tor globaleaks

if which pycompile >/dev/null 2>&1; then
  pycompile -p globaleaks
fi

#DEBHELPER#
