#!/bin/sh

set -e

if systemctl list-unit-files | grep 'dimdns.service'; then
 if pgrep dns && systemctl stop dimdns; then
  echo "dimdns stopped"
 fi
 if systemctl disable dimdns; then
  echo "dimdns disabled"
 fi
fi

readonly optdim="/opt/dim"
readonly optweb="/opt/WebDID"
readonly optdimsite="/opt/dimsite"

for lnk in $optdim $optweb $optdimsite; do
 if [ -L $lnk ]; then
  rm -f $lnk
 fi
done
