#!/bin/sh

set -e

echo "DEBUG: '$0' '$1' '$2'"
if test $1 = "configure"; then
	if test -z "`getent passwd irmp3`"; then
		# Create the user for the daemon to run as.
		adduser --system --home /var/lib/irmp3 irmp3
		# And add the user to the audio group so it can access the audio device.
		adduser irmp3 audio
		# We also need to load CDs.
		adduser irmp3 cdrom
		# Now make sure the user can modify the files it needs access to.
		touch /var/log/irmp3.log && chown irmp3 /var/log/irmp3.log
	fi
fi

# Now let the debhelper scripts do their thing.
#DEBHELPER#
