#!/bin/sh -e

if [ "$1" = "configure" ]; then

if grep -q icecast /etc/passwd; then
# clean up from bad useradd command, delete icecast user and recreate with --system
userdel icecast
fi
# add icecast user and group
adduser --system --disabled-password --disabled-login --home /usr/share/icecast/static --no-create-home --group icecast 
# change ownership of directory
chown -R icecast.icecast /usr/share/icecast/
chown -R icecast.icecast /var/log/icecast/
chown -R icecast.icecast /etc/icecast/
fi
