#!/bin/sh -e

# checking mix daemon account

uid=`getent passwd mix | cut -d ":" -f 3`

# if there is the uid the account is there and we can do
# the sanit(ar)y checks otherwise we can safely create it.

if [ "$uid" ]; then

	if [ $uid -ge 100 ] && [ $uid -le 999 ]; then
	  echo "mix daemon uid check: ok"
	else
	  echo "ERROR: mix account has a non-system uid!"
	  echo "correct this problem"
	  exit 1
	fi

else
    adduser --quiet --system --disabled-password --home /var/lib/httpsdnsd --no-create-home --shell /bin/bash --group mix
fi

