#!/bin/sh

set -e

USERNAME=snapserver
HOMEDIR=/var/lib/snapserver

if [ "$1" = configure ]; then
  if ! getent passwd $USERNAME >/dev/null; then
    adduser --system --quiet --group --home $HOMEDIR --no-create-home --force-badname $USERNAME
    # adduser $USERNAME audio
  fi
  adduser --quiet $USERNAME audio > /dev/null || true

  if [ ! -d $HOMEDIR ]; then
    mkdir -m 0750 $HOMEDIR
    chown $USERNAME:$USERNAME $HOMEDIR
  fi
fi

#DEBHELPER#
