#!/bin/bash
# $Id$

set -e

user_exists=$(id -u fhem > /dev/null 2>&1; echo $?)
if [ "$user_exists" -eq "0" ]; then
    echo "deleting user fhem"
    userdel fhem
fi

if test -f /etc/init/fhem.conf; then
    rm /etc/init/fhem.conf
fi

if test -f /etc/init.d/fhem; then
    rm /etc/init.d/fhem
fi

if test -f /etc/systemd/system/fhem.service; then
    rm /etc/systemd/system/fhem.service
fi