From 01d761ce71b17429432d720e985623a3b8cc30df Mon Sep 17 00:00:00 2001
From: CanbiZ <47820557+MickLesk@users.noreply.github.com>
Date: Thu, 13 Feb 2025 15:23:29 +0100
Subject: [PATCH] New Script: Nx Witness (#2350)
* New Script: NX Witness
* Update nxwitness.json
---
ct/nxwitness.sh | 70 ++++++++++++++++++++++++++++++++++++
install/nxwitness-install.sh | 49 +++++++++++++++++++++++++
json/nxwitness.json | 34 ++++++++++++++++++
3 files changed, 153 insertions(+)
create mode 100644 ct/nxwitness.sh
create mode 100644 install/nxwitness-install.sh
create mode 100644 json/nxwitness.json
diff --git a/ct/nxwitness.sh b/ct/nxwitness.sh
new file mode 100644
index 000000000..35fb307a8
--- /dev/null
+++ b/ct/nxwitness.sh
@@ -0,0 +1,70 @@
+#!/usr/bin/env bash
+source <(curl -s https://raw.githubusercontent.com/community-scripts/ProxmoxVE/main/misc/build.func)
+# Copyright (c) 2021-2025 community-scripts ORG
+# Author: MickLesk (CanbiZ)
+# License: MIT | https://github.com/community-scripts/ProxmoxVE/raw/main/LICENSE
+# Source: https://nxvms.com/download/releases/linux
+
+APP="NxWitness"
+var_tags="nvr"
+var_cpu="2"
+var_ram="2048"
+var_disk="8"
+var_os="ubuntu"
+var_version="24.04"
+var_unprivileged="0"
+
+header_info "$APP"
+variables
+color
+catch_errors
+
+function update_script() {
+ header_info
+ check_container_storage
+ check_container_resources
+ if [[ ! -f /etc/systemd/system/networkoptix-mediaserver.service ]]; then
+ msg_error "No ${APP} Installation Found!"
+ exit
+ fi
+ BASE_URL="https://updates.networkoptix.com/default/index.html"
+ RELEASE=$(curl -s "$BASE_URL" | grep -oP '(?<=)[0-9]+\.[0-9]+\.[0-9]+\.[0-9]+(?=)' | head -n 1)
+ DETAIL_PAGE=$(curl -s "$BASE_URL#note_$RELEASE")
+ DOWNLOAD_URL=$(echo "$DETAIL_PAGE" | grep -oP "https://updates.networkoptix.com/default/$RELEASE/linux/nxwitness-server-[0-9]+\.[0-9]+\.[0-9]+\.[0-9]+-linux_x64\.deb" | head -n 1)
+ if [[ ! -f /opt/${APP}_version.txt ]] || [[ "${RELEASE}" != "$(cat /opt/${APP}_version.txt)" ]]; then
+ msg_info "Stopping ${APP}"
+ systemctl stop networkoptix-root-tool networkoptix-mediaserver
+ msg_ok "${APP} Stopped"
+
+ msg_info "Updating ${APP} to ${RELEASE}"
+ cd /tmp
+ wget -q "$DOWNLOAD_URL" -O "nxwitness-server-$RELEASE-linux_x64.deb"
+ export DEBIAN_FRONTEND=noninteractive
+ export DEBCONF_NOWARNINGS=yes
+ dpkg -i nxwitness-server-$RELEASE-linux_x64.deb >/dev/null 2>&1
+ echo "${RELEASE}" >/opt/${APP}_version.txt
+ msg_ok "Updated ${APP}"
+
+ msg_info "Starting ${APP}"
+ systemctl start networkoptix-root-tool networkoptix-mediaserver
+ msg_ok "Started ${APP}"
+
+ msg_info "Cleaning up"
+ rm -f /tmp/nxwitness-server-$RELEASE-linux_x64.deb
+ msg_ok "Cleaned"
+
+ msg_ok "Updated Successfully"
+ else
+ msg_ok "No update required. ${APP} is already at ${RELEASE}"
+ fi
+ exit
+}
+
+start
+build_container
+description
+
+msg_ok "Completed Successfully!\n"
+echo -e "${CREATING}${GN}${APP} setup has been successfully initialized!${CL}"
+echo -e "${INFO}${YW} Access it using the following URL:${CL}"
+echo -e "${TAB}${GATEWAY}${BGN}http://${IP}:7001/${CL}"
diff --git a/install/nxwitness-install.sh b/install/nxwitness-install.sh
new file mode 100644
index 000000000..625e81fb0
--- /dev/null
+++ b/install/nxwitness-install.sh
@@ -0,0 +1,49 @@
+#!/usr/bin/env bash
+
+# Copyright (c) 2021-2025 community-scripts ORG
+# Author: MickLesk (CanbiZ)
+# License: MIT | https://github.com/community-scripts/ProxmoxVE/raw/main/LICENSE
+# Source: https://nxvms.com/download/releases/linux
+
+source /dev/stdin <<<"$FUNCTIONS_FILE_PATH"
+color
+verb_ip6
+catch_errors
+setting_up_container
+network_check
+update_os
+
+msg_info "Installing Dependencies"
+$STD apt-get install -y \
+ curl \
+ sudo \
+ mc \
+ make \
+ net-tools \
+ ffmpeg \
+ cifs-utils \
+ libtalloc2 \
+ libwbclient0 \
+ keyutils
+msg_ok "Installed Dependencies"
+
+msg_info "Setup Nx Witness"
+cd /tmp
+BASE_URL="https://updates.networkoptix.com/default/index.html"
+RELEASE=$(curl -s "$BASE_URL" | grep -oP '(?<=)[0-9]+\.[0-9]+\.[0-9]+\.[0-9]+(?=)' | head -n 1)
+DETAIL_PAGE=$(curl -s "$BASE_URL#note_$RELEASE")
+DOWNLOAD_URL=$(echo "$DETAIL_PAGE" | grep -oP "https://updates.networkoptix.com/default/$RELEASE/linux/nxwitness-server-[0-9]+\.[0-9]+\.[0-9]+\.[0-9]+-linux_x64\.deb" | head -n 1)
+wget -q "$DOWNLOAD_URL" -O "nxwitness-server-$RELEASE-linux_x64.deb"
+export DEBIAN_FRONTEND=noninteractive
+$STD dpkg -i nxwitness-server-$RELEASE-linux_x64.deb
+echo "${RELEASE}" >/opt/${APPLICATION}_version.txt
+msg_ok "Setup Nx Witness"
+
+motd_ssh
+customize
+
+msg_info "Cleaning up"
+rm -f /tmp/nxwitness-server-$RELEASE-linux_x64.deb
+$STD apt-get -y autoremove
+$STD apt-get -y autoclean
+msg_ok "Cleaned"
\ No newline at end of file
diff --git a/json/nxwitness.json b/json/nxwitness.json
new file mode 100644
index 000000000..b9b587f29
--- /dev/null
+++ b/json/nxwitness.json
@@ -0,0 +1,34 @@
+{
+ "name": "Nx Witness",
+ "slug": "nxwitness",
+ "categories": [
+ 15
+ ],
+ "date_created": "2025-02-13",
+ "type": "ct",
+ "updateable": true,
+ "privileged": true,
+ "interface_port": 7001,
+ "documentation": "https://support.networkoptix.com/hc/en-us/articles/360006863413-Access-the-Nx-Witness-User-Manual",
+ "website": "https://www.networkoptix.com/nx-witness",
+ "logo": "https://www.networkoptix.com/hs-fs/hubfs/raw_assets/public/NetworkOptix-NB/images/logo.png?width=300&height=75&name=logo.png",
+ "description": "Nx Witness is a professional video management system (VMS) designed for IP cameras and surveillance systems. It provides real-time video streaming, recording, and remote access with an intuitive user interface. The software supports AI-based video analytics, integrates with third-party security systems, and offers advanced search and event management features. It is used for security monitoring, business intelligence, and large-scale surveillance deployments.",
+ "install_methods": [
+ {
+ "type": "default",
+ "script": "ct/nxwitness.sh",
+ "resources": {
+ "cpu": 2,
+ "ram": 2048,
+ "hdd": 8,
+ "os": "ubuntu",
+ "version": "24.04"
+ }
+ }
+ ],
+ "default_credentials": {
+ "username": null,
+ "password": null
+ },
+ "notes": []
+}