SB_USER=sickbeard post_install() { getent passwd ${SB_USER} > /dev/null || useradd -d /opt/sickbeard -s /bin/false -r ${SB_USER} -m > /dev/null chown -R ${SB_USER}. /opt/sickbeard # Create a directory in /run if it does not exist if [ ! -d /run/sickbeard ]; then mkdir /run/sickbeard chown ${SB_USER}. /run/sickbeard chmod 775 /run/sickbeard fi } post_upgrade() { post_install } post_remove() { echo "Some files have not been removed because they are created by sickbeard itself, e.g. the show database." userdel -f ${SB_USER} }