systemd-sysusers boinc.conf

if [ ! -d /var/lib/boinc ]; then
    install -d /var/lib/boinc
fi

chown -R boinc:boinc /var/lib/boinc

echo -e "Checking whether systemd units need to be reload..."
if [[ $(systemctl show boinc-client.service --property=NeedDaemonReload | cut -d= -f2) == "yes" ]]; then
    echo "Reloading systemd units ..."
    systemctl daemon-reload
    echo "Restarting boinc-client service ..."
    systemctl try-restart boinc-client.service
else
    echo "Nothing needs reloading."
fi
