From 38be75aa539b0161211b80a1532bf8188172f8d8 Mon Sep 17 00:00:00 2001
From: CanbiZ <47820557+MickLesk@users.noreply.github.com>
Date: Mon, 29 Apr 2024 15:26:57 +0200
Subject: [PATCH] Update ersatztv-install.sh

Finalize
---
 install/ersatztv-install.sh | 13 +++++--------
 1 file changed, 5 insertions(+), 8 deletions(-)

diff --git a/install/ersatztv-install.sh b/install/ersatztv-install.sh
index 4f317baf..53a9c3ed 100644
--- a/install/ersatztv-install.sh
+++ b/install/ersatztv-install.sh
@@ -29,13 +29,10 @@ $STD apt-get install -y --no-install-recommends \
 msg_ok "Installed Dependencies"
 
 
-msg_info "Installing ErsatzTV (Patience)" 
-cd /opt
-RELEASE=$(curl -s https://api.github.com/repos/ErsatzTV/ErsatzTV/releases | grep "tag_name" | awk '{print substr($2, 2, length($2)-3) }' | head -n 1)
-wget -q https://github.com/ErsatzTV/ErsatzTV/releases/download/${RELEASE}/ErsatzTV-${RELEASE}-linux-x64.tar.gz
-tar -xf ErsatzTV-${RELEASE}-linux-x64.tar.gz 
-mv ErsatzTV-${RELEASE}-linux-x64 ErsatzTV
-rm -R ErsatzTV-${RELEASE}-linux-x64.tar.gz 
+msg_info "Installing ErsatzTV " 
+RELEASE=$(curl -s https://api.github.com/repos/ErsatzTV/ErsatzTV/releases | grep -oP '"tag_name": "\K[^"]+' | head -n 1)
+wget -qO- "https://github.com/ErsatzTV/ErsatzTV/releases/download/${RELEASE}/ErsatzTV-${RELEASE}-linux-x64.tar.gz" | tar -xz -C /opt
+mv "/opt/ErsatzTV-${RELEASE}-linux-x64" /opt/ErsatzTV
 msg_ok "Installed ErsatzTV"
 
 msg_info "Creating Service"
@@ -45,6 +42,7 @@ Description=ErsatzTV Service
 After=multi-user.target
 
 [Service]
+Type=simple
 User=root
 WorkingDirectory=/opt/ErsatzTV 
 ExecStart=/opt/ErsatzTV/ErsatzTV  
@@ -54,7 +52,6 @@ RestartSec=30
 [Install]
 WantedBy=multi-user.target
 EOF
-sudo systemctl daemon-reload
 systemctl -q --now enable ersatzTV.service
 msg_ok "Created Service"