#!/bin/bash

if [[ -d /usr/local/technitium ]]; then
    mv /usr/local/technitium/config /tmp
    rm -r /usr/local/technitium
fi

mkdir /usr/local/technitium
cd /usr/local/technitium

wget https://download.technitium.com/dns/DnsServerPortable.tar.gz
gunzip DnsServerPortable.tar.gz
tar xvf DnsServerPortable.tar

[[ -d /tmp/config ]] && mv /tmp/config .

rm DnsServerPortable.tar DnsServerPortable.tar.gz

cat DnsServerApp.runtimeconfig.json | jq '.runtimeOptions.frameworks.[].version = "10.0.3"' | tee DnsServerApp.runtimeconfig.json