From 36523dfd33913e35fc383538fb16a6fa9da50a85 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Slavi=C5=A1a=20Are=C5=BEina?= <58952836+tremor021@users.noreply.github.com> Date: Tue, 19 Aug 2025 14:05:37 +0200 Subject: [PATCH] Refactor: Technitium DNS (#6968) * Refactor * Update json * Update --- ct/technitiumdns.sh | 21 ++++++++++++--------- frontend/public/json/technitiumdns.json | 7 +------ install/technitiumdns-install.sh | 12 +++++++++++- 3 files changed, 24 insertions(+), 16 deletions(-) diff --git a/ct/technitiumdns.sh b/ct/technitiumdns.sh index efc6b665b..c9e578544 100644 --- a/ct/technitiumdns.sh +++ b/ct/technitiumdns.sh @@ -27,17 +27,20 @@ function update_script() { msg_error "No ${APP} Installation Found!" exit fi - msg_info "Updating ${APP}" - if ! dpkg -s aspnetcore-runtime-8.0 >/dev/null 2>&1; then - curl -fsSL "https://packages.microsoft.com/config/debian/12/packages-microsoft-prod.deb" -o $(basename "https://packages.microsoft.com/config/debian/12/packages-microsoft-prod.deb") - $STD dpkg -i packages-microsoft-prod.deb - $STD apt-get update - $STD apt-get install -y aspnetcore-runtime-8.0 - rm packages-microsoft-prod.deb + RELEASE=$(curl -fsSL https://technitium.com/dns/ | grep -oP 'Version \K[\d.]+') + if [[ ! -f ~/.technitium || "${VERSION}" != "$(cat ~/.technitium)" ]]; then + msg_info "Updating ${APP}" + curl -fsSL "https://download.technitium.com/dns/DnsServerPortable.tar.gz" -o /opt/DnsServerPortable.tar.gz + $STD tar zxvf /opt/DnsServerPortable.tar.gz -C /opt/technitium/dns/ + msg_ok "Updated Successfully" + + msg_info "Cleaning up" + rm -f /opt/DnsServerPortable.tar.gz + msg_ok "Cleaned up" + else + msg_ok "No update required. ${APP} is already at v${RELEASE}." fi - $STD bash <(curl -fsSL https://download.technitium.com/dns/install.sh) - msg_ok "Updated Successfully" exit } diff --git a/frontend/public/json/technitiumdns.json b/frontend/public/json/technitiumdns.json index bd9bb47d4..57376feef 100644 --- a/frontend/public/json/technitiumdns.json +++ b/frontend/public/json/technitiumdns.json @@ -31,10 +31,5 @@ "username": null, "password": null }, - "notes": [ - { - "text": "WARNING: Installation sources scripts outside of Community Scripts repo. Please check the source before installing.", - "type": "warning" - } - ] + "notes": [] } diff --git a/install/technitiumdns-install.sh b/install/technitiumdns-install.sh index 846ffa64c..f30893bb1 100644 --- a/install/technitiumdns-install.sh +++ b/install/technitiumdns-install.sh @@ -21,14 +21,24 @@ $STD apt-get update $STD apt-get install -y aspnetcore-runtime-8.0 msg_ok "Installed ASP.NET Core Runtime" +RELEASE=$(curl -fsSL https://technitium.com/dns/ | grep -oP 'Version \K[\d.]+') msg_info "Installing Technitium DNS" -$STD bash <(curl -fsSL https://download.technitium.com/dns/install.sh) +mkdir -p /opt/technitium/dns +curl -fsSL "https://download.technitium.com/dns/DnsServerPortable.tar.gz" -o /opt/DnsServerPortable.tar.gz +$STD tar zxvf /opt/DnsServerPortable.tar.gz -C /opt/technitium/dns/ +echo "${RELEASE}" > ~/.technitium msg_ok "Installed Technitium DNS" +msg_info "Creating service" +cp /opt/technitium/dns/systemd.service /etc/systemd/system/technitium.service +systemctl enable -q --now technitium +msg_ok "Service created" + motd_ssh customize msg_info "Cleaning up" +rm -f /opt/DnsServerPortable.tar.gz $STD apt-get -y autoremove $STD apt-get -y autoclean msg_ok "Cleaned"