diff --git a/ct/agentdvr.sh b/ct/agentdvr.sh index ed7afd51d6..b006590b6c 100644 --- a/ct/agentdvr.sh +++ b/ct/agentdvr.sh @@ -27,7 +27,30 @@ function update_script() { msg_error "No ${APP} Installation Found!" exit fi - msg_error "Currently we don't provide an update function for this ${APP}." + + RELEASE=$(curl -fsSL "https://www.ispyconnect.com/api/Agent/DownloadLocation4?platform=Linux64&fromVersion=0" | grep -o 'https://.*\.zip') + if [[ "${RELEASE}" != "$(cat ~/.agentdvr 2>/dev/null)" ]] || [[ ! -f ~/.agentdvr ]]; then + msg_info "Stopping service" + systemctl stop AgentDVR + msg_ok "Service stopped" + + msg_info "Updating $APP" + cd /opt/agentdvr/agent + curl -fsSL "$RELEASE" -o $(basename "$RELEASE") + $STD unzip -o Agent_Linux64*.zip + chmod +x ./Agent + echo $RELEASE > ~/.agentdvr + rm -rf Agent_Linux64*.zip + msg_ok "Updated $APP" + + msg_info "Starting service" + systemctl start AgentDVR + msg_ok "Service started" + + msg_ok "Updated $APP successfully" + else + msg_ok "No update required. ${APP} is already at ${RELEASE}" + fi exit } diff --git a/frontend/public/json/agentdvr.json b/frontend/public/json/agentdvr.json index b94e691874..27fab2fb17 100644 --- a/frontend/public/json/agentdvr.json +++ b/frontend/public/json/agentdvr.json @@ -6,7 +6,7 @@ ], "date_created": "2024-05-02", "type": "ct", - "updateable": false, + "updateable": true, "privileged": true, "interface_port": 8090, "documentation": "https://www.ispyconnect.com/docs/agent/about", diff --git a/install/agentdvr-install.sh b/install/agentdvr-install.sh index d09912a232..4468b5e369 100644 --- a/install/agentdvr-install.sh +++ b/install/agentdvr-install.sh @@ -29,6 +29,7 @@ cd /opt/agentdvr/agent curl -fsSL "$RELEASE" -o $(basename "$RELEASE") $STD unzip Agent_Linux64*.zip chmod +x ./Agent +echo $RELEASE > ~/.agentdvr msg_ok "Installed AgentDVR" msg_info "Creating Service"