#!/bin/sh

set -e

USERNAME=snapclient
HOMEDIR=/var/lib/snapclient

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

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

#DEBHELPER#
