From 74a227667122a8dbe6ed0a1eac69046575fac660 Mon Sep 17 00:00:00 2001 From: pkubaj Date: Mon, 29 Nov 2021 00:03:45 +0000 Subject: [PATCH 1/8] Fix build on FreeBSD/armv7 1. FreeBSD uses elf_aux_info instead of getauxval. 2. FreeBSD uses HWCAP_NEON macro for Neon. --- src/zm_utils.cpp | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/src/zm_utils.cpp b/src/zm_utils.cpp index 5da5509ff..409429667 100644 --- a/src/zm_utils.cpp +++ b/src/zm_utils.cpp @@ -252,8 +252,15 @@ void HwCapsDetect() { #elif defined(__arm__) // ARM processor in 32bit mode // To see if it supports NEON, we need to get that information from the kernel + #ifdef __linux__ unsigned long auxval = getauxval(AT_HWCAP); if (auxval & HWCAP_ARM_NEON) { + #elif defined(__FreeBSD__) + unsigned long auxval = 0; + elf_aux_info(AT_HWCAP, &auxval, sizeof(auxval)); + if (auxval & HWCAP_NEON) { + #error Unsupported OS. + #endif Debug(1,"Detected ARM (AArch32) processor with Neon"); neonversion = 1; } else { From 01f4aee45034cea6e027dc6be031e0277a794133 Mon Sep 17 00:00:00 2001 From: Isaac Connor Date: Sat, 27 Nov 2021 19:10:09 -0500 Subject: [PATCH 2/8] Fix underline --- docs/installationguide/debian.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/installationguide/debian.rst b/docs/installationguide/debian.rst index f7325fe1f..e6a3404df 100644 --- a/docs/installationguide/debian.rst +++ b/docs/installationguide/debian.rst @@ -4,7 +4,7 @@ Debian .. contents:: Easy Way: Debian 11 (Bullseye) ------------------------- +------------------------------ This procedure will guide you through the installation of ZoneMinder on Debian 11 (Bullseye). From 1f19ad7c9d9b483a92679f225c4efbafd9f3e290 Mon Sep 17 00:00:00 2001 From: Isaac Connor Date: Sat, 27 Nov 2021 19:16:32 -0500 Subject: [PATCH 3/8] fix by removing code block --- docs/installationguide/debian.rst | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/installationguide/debian.rst b/docs/installationguide/debian.rst index e6a3404df..b92ff267a 100644 --- a/docs/installationguide/debian.rst +++ b/docs/installationguide/debian.rst @@ -104,7 +104,7 @@ Add the following to the /etc/apt/sources.list.d/zoneminder.list file You can do this using: -.. code-block:: +:: echo "deb https://zmrepo.zoneminder.com/debian/release-1.36 buster/" | sudo tee /etc/apt/sources.list.d/zoneminder.list From ea6a84ae66ea3a3d7ae72f6ba5047b815bb26db7 Mon Sep 17 00:00:00 2001 From: Isaac Connor Date: Mon, 29 Nov 2021 12:53:44 -0500 Subject: [PATCH 4/8] Fix AlarmEndCommand => EventEndCommand --- db/zm_update-1.37.5.sql | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/db/zm_update-1.37.5.sql b/db/zm_update-1.37.5.sql index 1f40eb923..0f205ff77 100644 --- a/db/zm_update-1.37.5.sql +++ b/db/zm_update-1.37.5.sql @@ -7,7 +7,7 @@ SET @s = (SELECT IF( FROM INFORMATION_SCHEMA.COLUMNS WHERE table_name = 'Monitors' AND table_schema = DATABASE() - AND column_name = 'AlarmEndCommand' + AND column_name = 'EventEndCommand' ) > 0, "SELECT 'Column EventEndCommand already exists in Monitors'", "ALTER TABLE `Monitors` ADD COLUMN `EventEndCommand` VARCHAR(255) NOT NULL DEFAULT '' AFTER `Triggers`" From 072d181f79c41889ba44107ade0f48254157c2ae Mon Sep 17 00:00:00 2001 From: Isaac Connor Date: Mon, 29 Nov 2021 12:54:46 -0500 Subject: [PATCH 5/8] Fix AlarmStartCommand => EventStartCommand --- db/zm_update-1.37.5.sql | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/db/zm_update-1.37.5.sql b/db/zm_update-1.37.5.sql index 0f205ff77..035a73a1a 100644 --- a/db/zm_update-1.37.5.sql +++ b/db/zm_update-1.37.5.sql @@ -21,7 +21,7 @@ SET @s = (SELECT IF( FROM INFORMATION_SCHEMA.COLUMNS WHERE table_name = 'Monitors' AND table_schema = DATABASE() - AND column_name = 'AlarmStartCommand' + AND column_name = 'EventStartCommand' ) > 0, "SELECT 'Column EventStartCommand already exists in Monitors'", "ALTER TABLE `Monitors` ADD COLUMN `EventStartCommand` VARCHAR(255) NOT NULL DEFAULT '' AFTER `Triggers`" From 82a4cbaec520cc46ad2e75aba5e433013da80f46 Mon Sep 17 00:00:00 2001 From: Isaac Connor Date: Mon, 29 Nov 2021 13:48:44 -0500 Subject: [PATCH 6/8] Fix task=>action so that deleting works. Pause streaming before delete to prevent errors being logged due to missing files --- web/skins/classic/views/js/event.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/web/skins/classic/views/js/event.js b/web/skins/classic/views/js/event.js index 05914f911..94e132cc1 100644 --- a/web/skins/classic/views/js/event.js +++ b/web/skins/classic/views/js/event.js @@ -773,8 +773,9 @@ function manageDelConfirmModalBtns() { return; } + pauseClicked(); evt.preventDefault(); - $j.getJSON(thisUrl + '?request=event&task=delete&id='+eventData.Id) + $j.getJSON(thisUrl + '?request=event&action=delete&id='+eventData.Id) .done(function(data) { $j('#deleteConfirm').modal('hide'); streamNext(true); From 089563d1cecb5d04c8b7876f585e050390af5d73 Mon Sep 17 00:00:00 2001 From: Isaac Connor Date: Mon, 29 Nov 2021 14:14:56 -0500 Subject: [PATCH 7/8] rework do_debian_package to properly support the CURRENT style of snapshots and make the code a little easier to read --- utils/do_debian_package.sh | 122 ++++++++++++++++++++----------------- 1 file changed, 65 insertions(+), 57 deletions(-) diff --git a/utils/do_debian_package.sh b/utils/do_debian_package.sh index 6c8c06c00..91ecf520b 100755 --- a/utils/do_debian_package.sh +++ b/utils/do_debian_package.sh @@ -116,52 +116,6 @@ else echo "Defaulting to ZoneMinder upstream git" GITHUB_FORK="ZoneMinder" fi; - if [ "$SNAPSHOT" == "stable" ]; then - if [ "$BRANCH" == "" ]; then - #REV=$(git rev-list --tags --max-count=1) - BRANCH=`git describe --tags $(git rev-list --tags --max-count=1)`; - if [ -z "$BRANCH" ]; then - # This should only happen in CI environments where tag info isn't available - BRANCH=`cat version` - echo "Building branch $BRANCH" - fi - if [ "$BRANCH" == "" ]; then - echo "Unable to determine latest stable branch!" - exit 0; - fi - echo "Latest stable branch is $BRANCH"; - fi; - else - if [ "$BRANCH" == "" ]; then - echo "Defaulting to master branch"; - BRANCH="master"; - fi; - if [ "$SNAPSHOT" == "NOW" ]; then - SNAPSHOT=`date +%Y%m%d%H%M%S`; - else - if [ "$SNAPSHOT" == "CURRENT" ]; then - SNAPSHOT="`date +%Y%m%d.`$(git rev-list ${versionhash}..HEAD --count)" - fi; - fi; - fi; -fi - -IFS='.' read -r -a VERSION_PARTS <<< "$RELEASE" -if [ "$PPA" == "" ]; then - if [ "$RELEASE" != "" ]; then - # We need to use our official tarball for the original source, so grab it and overwrite our generated one. - if [ "${VERSION_PARTS[0]}.${VERSION_PARTS[1]}" == "1.30" ]; then - PPA="ppa:iconnor/zoneminder-stable" - else - PPA="ppa:iconnor/zoneminder-${VERSION_PARTS[0]}.${VERSION_PARTS[1]}" - fi; - else - if [ "$BRANCH" == "" ]; then - PPA="ppa:iconnor/zoneminder-master"; - else - PPA="ppa:iconnor/zoneminder-$BRANCH"; - fi; - fi; fi; # Instead of cloning from github each time, if we have a fork lying around, update it and pull from there instead. @@ -171,15 +125,8 @@ if [ ! -d "${GITHUB_FORK}_zoneminder_release" ]; then cd "${GITHUB_FORK}_ZoneMinder.git" echo "git fetch..." git fetch - echo "git checkout $BRANCH" - git checkout $BRANCH - if [ $? -ne 0 ]; then - echo "Failed to switch to branch." - exit 1; - fi; - echo "git pull..." - git pull cd ../ + echo "git clone ${GITHUB_FORK}_ZoneMinder.git ${GITHUB_FORK}_zoneminder_release" git clone "${GITHUB_FORK}_ZoneMinder.git" "${GITHUB_FORK}_zoneminder_release" else @@ -192,14 +139,59 @@ else fi; cd "${GITHUB_FORK}_zoneminder_release" - git checkout $BRANCH -cd ../ -VERSION=`cat ${GITHUB_FORK}_zoneminder_release/version` +if [ "$SNAPSHOT" == "stable" ]; then + if [ "$BRANCH" == "" ]; then + #REV=$(git rev-list --tags --max-count=1) + BRANCH=`git describe --tags $(git rev-list --tags --max-count=1)`; + if [ -z "$BRANCH" ]; then + # This should only happen in CI environments where tag info isn't available + BRANCH=`cat version` + echo "Building branch $BRANCH" + fi + if [ "$BRANCH" == "" ]; then + echo "Unable to determine latest stable branch!" + exit 0; + fi + echo "Latest stable branch is $BRANCH"; + fi; +else + if [ "$BRANCH" == "" ]; then + echo "Defaulting to master branch"; + BRANCH="master"; + fi; + if [ "$SNAPSHOT" == "NOW" ]; then + SNAPSHOT=`date +%Y%m%d%H%M%S`; + else + if [ "$SNAPSHOT" == "CURRENT" ]; then + # git the latest (short) commit hash of the version file + versionhash=$(git log -n1 --pretty=format:%h version) + # Number of commits since the version file was last changed + numcommits=$(git rev-list ${versionhash}..HEAD --count) + SNAPSHOT="`date +%Y%m%d.`$(git rev-list ${versionhash}..HEAD --count)" + fi; + fi; +fi; + + +echo "git checkout $BRANCH" +git checkout $BRANCH +if [ $? -ne 0 ]; then + echo "Failed to switch to branch." + exit 1; +fi; +echo "git pull..." +git pull +# Grab the ZoneMinder version from the contents of the version file +VERSION=$(cat version) if [ -z "$VERSION" ]; then exit 1; fi; +IFS='.' read -r -a VERSION_PARTS <<< "$VERSION" + +cd ../ + if [ "$SNAPSHOT" != "stable" ] && [ "$SNAPSHOT" != "" ]; then VERSION="$VERSION~$SNAPSHOT"; fi; @@ -357,6 +349,22 @@ EOF fi; else SC="zoneminder_${VERSION}-${DISTRO}${PACKAGE_VERSION}_source.changes"; + if [ "$PPA" == "" ]; then + if [ "$RELEASE" != "" ]; then + # We need to use our official tarball for the original source, so grab it and overwrite our generated one. + if [ "${VERSION_PARTS[0]}.${VERSION_PARTS[1]}" == "1.30" ]; then + PPA="ppa:iconnor/zoneminder-stable" + else + PPA="ppa:iconnor/zoneminder-${VERSION_PARTS[0]}.${VERSION_PARTS[1]}" + fi; + else + if [ "$BRANCH" == "" ]; then + PPA="ppa:iconnor/zoneminder-master"; + else + PPA="ppa:iconnor/zoneminder-$BRANCH"; + fi; + fi; + fi; dput="Y"; if [ "$INTERACTIVE" != "no" ]; then From 7b9c86111c094662e485a94417755a7e230de8b2 Mon Sep 17 00:00:00 2001 From: Isaac Connor Date: Mon, 29 Nov 2021 16:21:34 -0500 Subject: [PATCH 8/8] Move Cleanup and framebuffer freeing into Close() so that we don't crash on Reload --- src/zm_libvnc_camera.cpp | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/src/zm_libvnc_camera.cpp b/src/zm_libvnc_camera.cpp index 6fb414686..3ff7804b6 100644 --- a/src/zm_libvnc_camera.cpp +++ b/src/zm_libvnc_camera.cpp @@ -23,7 +23,7 @@ void bind_libvnc_symbols() { libvnc_lib = dlopen("libvncclient.so", RTLD_LAZY | RTLD_GLOBAL); if (!libvnc_lib) { - Error("Error loading libvncclient: %s", dlerror()); + Error("Error loading libvncclient.so: %s", dlerror()); return; } @@ -135,11 +135,6 @@ VncCamera::VncCamera( } VncCamera::~VncCamera() { - if (capture and mRfb) { - if (mRfb->frameBuffer) - free(mRfb->frameBuffer); - (*rfbClientCleanup_f)(mRfb); - } if (libvnc_lib) { dlclose(libvnc_lib); libvnc_lib = nullptr; @@ -253,6 +248,12 @@ int VncCamera::PostCapture() { } int VncCamera::Close() { + if (capture and mRfb) { + if (mRfb->frameBuffer) + free(mRfb->frameBuffer); + (*rfbClientCleanup_f)(mRfb); + mRfb = nullptr; + } return 1; } #endif