#!/bin/bash

VERSION="1"

. /usr/share/univention-appcenter/joinscripthelper.sh

eval "$(ucr shell)"

joinscript_init

domainname="$(ucr get domainname)"
hostname="$(ucr get hostname)"

# remove vhost
univention-add-vhost --remove "relution.$hostname.$domainname" 443 "$@"
service apache2 reload

# remove apache config for "old" relution locations
apache_cfg="/etc/apache2/ucs-sites.conf.d/relution.conf"
if [ -e "$apache_cfg" ]; then
        rm "$apache_cfg"
        invoke-rc.d apache2 reload
fi

# unset app link
ucr unset ucs/web/overview/entries/service/relution/link

ucs_removeServiceFromLocalhost "${SERVICE}" "$@"

joinscript_remove_script_from_status_file relution

exit 0