* let cmake set path to arp

* declare cameras array

* fix probeV4L function

* typo

* fix another typo - my machine is possessed.

* update redhat, debian, ubuntu build dependencies
This commit is contained in:
Andrew Bauer 2018-07-11 14:43:59 -05:00 committed by Isaac Connor
parent 3d97b6343e
commit 18c3618e28
5 changed files with 80 additions and 78 deletions

View File

@ -802,6 +802,24 @@ if(WITH_SYSTEMD)
endif(NOT POLKIT_FOUND) endif(NOT POLKIT_FOUND)
endif(WITH_SYSTEMD) endif(WITH_SYSTEMD)
# Find the path to an arp compatible executable
if(ZM_PATH_ARP STREQUAL "")
find_program(ARP_EXECUTABLE arp)
if(ARP_EXECUTABLE)
set(ZM_PATH_ARP "${ARP_EXECUTABLE}")
mark_as_advanced(ARP_EXECUTABLE)
else(ARP_EXECUTABLE)
find_program(ARP_EXECUTABLE ip)
if(ARP_EXECUTABLE)
set(ZM_PATH_ARP "${ARP_EXECUTABLE} neigh")
mark_as_advanced(ARP_EXECUTABLE)
endif(ARP_EXECUTABLE)
endif(ARP_EXECUTABLE)
if(ARP_EXECUTABLE-NOTFOUND)
message(WARNING "Unable to find a compatible arp binary. Monitor probe will not function." )
endif(ARP_EXECUTABLE-NOTFOUND)
endif(ZM_PATH_ARP STREQUAL "")
# Some variables that zm expects # Some variables that zm expects
set(ZM_PID "${ZM_RUNDIR}/zm.pid") set(ZM_PID "${ZM_RUNDIR}/zm.pid")
set(ZM_CONFIG "${ZM_CONFIG_DIR}/zm.conf") set(ZM_CONFIG "${ZM_CONFIG_DIR}/zm.conf")

View File

@ -13,6 +13,7 @@ Build-Depends: debhelper (>= 9), cmake
, libv4l-dev (>= 0.8.3) , libv4l-dev (>= 0.8.3)
, libbz2-dev , libbz2-dev
, ffmpeg | libav-tools , ffmpeg | libav-tools
, net-tools
, libnetpbm10-dev , libnetpbm10-dev
, libvlccore-dev, libvlc-dev , libvlccore-dev, libvlc-dev
, libcurl4-gnutls-dev | libcurl4-nss-dev | libcurl4-openssl-dev , libcurl4-gnutls-dev | libcurl4-nss-dev | libcurl4-openssl-dev

View File

@ -52,6 +52,7 @@ BuildRequires: pcre-devel
BuildRequires: libjpeg-turbo-devel BuildRequires: libjpeg-turbo-devel
BuildRequires: findutils BuildRequires: findutils
BuildRequires: coreutils BuildRequires: coreutils
BuildRequires: net-tools
BuildRequires: perl BuildRequires: perl
BuildRequires: perl-generators BuildRequires: perl-generators
BuildRequires: perl(Archive::Tar) BuildRequires: perl(Archive::Tar)

View File

@ -11,6 +11,8 @@ Build-Depends: debhelper (>= 9), dh-systemd, python-sphinx | python3-sphinx, apa
,libavformat-dev (>= 6:10~) ,libavformat-dev (>= 6:10~)
,libavutil-dev (>= 6:10~) ,libavutil-dev (>= 6:10~)
,libswscale-dev (>= 6:10~) ,libswscale-dev (>= 6:10~)
,ffmpeg | libav-tools
,net-tools
,libbz2-dev ,libbz2-dev
,libgcrypt-dev | libgcrypt11-dev ,libgcrypt-dev | libgcrypt11-dev
,libcurl4-gnutls-dev ,libcurl4-gnutls-dev

View File

@ -110,6 +110,7 @@ function probeV4L() {
$device['inputs'] = $inputs; $device['inputs'] = $inputs;
$devices[] = $device; $devices[] = $device;
} # end foreach output line } # end foreach output line
return $cameras;
} # end function probeV4L } # end function probeV4L
// Probe Network Cameras // Probe Network Cameras
@ -206,7 +207,7 @@ function probeVivotek($ip) {
'Width' => 352, 'Width' => 352,
'Height' => 240, 'Height' => 240,
), ),
); );t
if ( $lines = @file($url) ) { if ( $lines = @file($url) ) {
foreach ( $lines as $line ) { foreach ( $lines as $line ) {
$line = rtrim($line); $line = rtrim($line);
@ -242,35 +243,14 @@ function probeWansview($ip) {
} }
function probeNetwork() { function probeNetwork() {
// Calling arp without the full path was reported to fail on some systems $cameras = array();
// Use the builtin unix command "type" to tell us where the command is
$arp_command = '';
$result = explode(' ', ZM_PATH_ARP);
if ( !is_executable($result[0]) ) {
if ( ZM_PATH_ARP ) {
Warning("User assigned ARP tool not found. Verify ZM_PATH_ARP points to a valid arp tool and is executable by the web user account.");
}
$result = exec('type -p arp', $output, $status);
if ( $status ) {
Warning("Unable to determine path for arp command, type -p arp returned '$status' output is: " . implode("\n", $output));
unset($output);
$result = exec('which arp', $output, $status);
if ( $status ) {
Warning("Unable to determine path for arp command, which arp returned '$status'");
if ( file_exists('/usr/sbin/arp') ) {
$arp_command = '/usr/sbin/arp -a';
}
} else {
$arp_command = $output[0].' -a';
}
} else {
$arp_command = $output[0].' -a';
}
} else {
$arp_command = ZM_PATH_ARP; $arp_command = ZM_PATH_ARP;
$result = explode(' ', $arp_command);
if ( !is_executable($result[0]) ) {
Error("ARP compatible binary not found or not executable by the web user account. Verify ZM_PATH_ARP points to a valid arp tool.");
return;
} }
// Now that we know where arp is, call it using the full path
unset($output);
$result = exec(escapeshellcmd($arp_command), $output, $status); $result = exec(escapeshellcmd($arp_command), $output, $status);
if ( $status ) { if ( $status ) {
Error("Unable to probe network cameras, status is '$status'"); Error("Unable to probe network cameras, status is '$status'");