diff --git a/ct/threadfin.sh b/ct/threadfin.sh index f996d3192..e328fe7ca 100644 --- a/ct/threadfin.sh +++ b/ct/threadfin.sh @@ -27,12 +27,24 @@ function update_script() { msg_error "No ${APP} Installation Found!" exit fi - msg_info "Updating $APP" - systemctl stop threadfin.service - curl -fsSL "https://github.com/Threadfin/Threadfin/releases/latest/download/Threadfin_linux_amd64" -o "/opt/threadfin/threadfin" - chmod +x /opt/threadfin/threadfin - systemctl start threadfin.service - msg_ok "Updated $APP" + + RELEASE=$(curl -fsSL https://api.github.com/repos/threadfin/threadfin/releases/latest | grep "tag_name" | awk '{print substr($2, 2, length($2)-3) }') + if [[ "${RELEASE}" != "$(cat ~/.threadfin 2>/dev/null)" ]] || [[ ! -f ~/.threadfin ]]; then + + msg_info "Stopping $APP" + systemctl stop threadfin + msg_ok "Stopped $APP" + + fetch_and_deploy_gh_release "threadfin" "threadfin/threadfin" "singlefile" "latest" "/opt/threadfin" "Threadfin_linux_amd64" + + msg_info "Starting $APP" + systemctl start threadfin + msg_ok "Started $APP" + + msg_ok "Updated Successfully" + else + msg_ok "No update required. ${APP} is already at v${RELEASE}" + fi exit } diff --git a/frontend/public/json/threadfin.json b/frontend/public/json/threadfin.json index 04774f663..81dd3cb9d 100644 --- a/frontend/public/json/threadfin.json +++ b/frontend/public/json/threadfin.json @@ -6,7 +6,7 @@ ], "date_created": "2024-06-12", "type": "ct", - "updateable": false, + "updateable": true, "privileged": false, "interface_port": 34400, "documentation": null, diff --git a/install/threadfin-install.sh b/install/threadfin-install.sh index 5e4b92a6d..9db423bd3 100644 --- a/install/threadfin-install.sh +++ b/install/threadfin-install.sh @@ -14,16 +14,12 @@ network_check update_os msg_info "Installing Dependencies" -$STD apt-get install -y ffmpeg -$STD apt-get install -y vlc +$STD apt-get install -y \ + ffmpeg \ + vlc msg_ok "Installed Dependencies" -msg_info "Installing Threadfin" -mkdir -p /opt/threadfin -curl -fsSL "https://github.com/Threadfin/Threadfin/releases/latest/download/Threadfin_linux_amd64" -o "/opt/threadfin/threadfin" -chmod +x /opt/threadfin/threadfin - -msg_ok "Installed Threadfin" +fetch_and_deploy_gh_release "threadfin" "threadfin/threadfin" "singlefile" "latest" "/opt/threadfin" "Threadfin_linux_amd64" msg_info "Creating Service" cat </etc/systemd/system/threadfin.service