Merge branch 'master' into storageareas
This commit is contained in:
commit
1958351a13
|
@ -42,7 +42,7 @@ This is the recommended method to install ZoneMinder onto your system. ZoneMinde
|
||||||
|
|
||||||
If a repository that hosts ZoneMinder packages is not available for your distro, then you are encouraged to build your own package, rather than build from source. While each distro is different in ways that set it apart from all the others, they are often similar enough to allow you to adapt another distro's package building instructions to your own.
|
If a repository that hosts ZoneMinder packages is not available for your distro, then you are encouraged to build your own package, rather than build from source. While each distro is different in ways that set it apart from all the others, they are often similar enough to allow you to adapt another distro's package building instructions to your own.
|
||||||
|
|
||||||
### Building a ZoneMinder Package
|
### Building a ZoneMinder Package ###
|
||||||
|
|
||||||
Building ZoneMinder into a package is not any harder than building from source. As a matter of fact, if you have successfully built ZoneMinder from source in the past, then you may find these steps to be easier.
|
Building ZoneMinder into a package is not any harder than building from source. As a matter of fact, if you have successfully built ZoneMinder from source in the past, then you may find these steps to be easier.
|
||||||
|
|
||||||
|
|
|
@ -13,6 +13,13 @@ The API is built in CakePHP and lives under the ``/api`` directory. It
|
||||||
provides a RESTful service and supports CRUD (create, retrieve, update, delete)
|
provides a RESTful service and supports CRUD (create, retrieve, update, delete)
|
||||||
functions for Monitors, Events, Frames, Zones and Config.
|
functions for Monitors, Events, Frames, Zones and Config.
|
||||||
|
|
||||||
|
Enabling API
|
||||||
|
^^^^^^^^^^^^
|
||||||
|
A default ZoneMinder installs with APIs enabled. You can explictly enable/disable the APIs
|
||||||
|
via the Options->System menu by enabling/disabling ``OPT_USE_API``. Note that if you intend
|
||||||
|
to use APIs with 3rd party apps, such as zmNinja or others that use APIs, you should also
|
||||||
|
enable ``AUTH_HASH_LOGINS``.
|
||||||
|
|
||||||
Login, Logout & API Security
|
Login, Logout & API Security
|
||||||
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
|
||||||
The APIs tie into ZoneMinder's existing security model. This means if you have
|
The APIs tie into ZoneMinder's existing security model. This means if you have
|
||||||
|
|
|
@ -704,6 +704,8 @@ sub Fatal( @ ) {
|
||||||
if ( $SIG{TERM} and ( $SIG{TERM} ne 'DEFAULT' ) ) {
|
if ( $SIG{TERM} and ( $SIG{TERM} ne 'DEFAULT' ) ) {
|
||||||
$SIG{TERM}();
|
$SIG{TERM}();
|
||||||
}
|
}
|
||||||
|
# I think if we don't disconnect we will leave sockets around in TIME_WAIT
|
||||||
|
zmDbDisconnect();
|
||||||
exit(-1);
|
exit(-1);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -292,48 +292,48 @@ sub checkFilter {
|
||||||
last if $zm_terminate;
|
last if $zm_terminate;
|
||||||
my $Event = new ZoneMinder::Event($$event{Id}, $event);
|
my $Event = new ZoneMinder::Event($$event{Id}, $event);
|
||||||
|
|
||||||
Debug("Checking event $event->{Id}");
|
Debug("Checking event $Event->{Id}");
|
||||||
my $delete_ok = !undef;
|
my $delete_ok = !undef;
|
||||||
$dbh->ping();
|
$dbh->ping();
|
||||||
if ( $filter->{AutoArchive} ) {
|
if ( $filter->{AutoArchive} ) {
|
||||||
Info("Archiving event $event->{Id}");
|
Info("Archiving event $Event->{Id}");
|
||||||
# Do it individually to avoid locking up the table for new events
|
# Do it individually to avoid locking up the table for new events
|
||||||
my $sql = 'UPDATE Events SET Archived = 1 WHERE Id = ?';
|
my $sql = 'UPDATE Events SET Archived = 1 WHERE Id = ?';
|
||||||
my $sth = $dbh->prepare_cached( $sql )
|
my $sth = $dbh->prepare_cached( $sql )
|
||||||
or Fatal("Unable to prepare '$sql': ".$dbh->errstr());
|
or Fatal("Unable to prepare '$sql': ".$dbh->errstr());
|
||||||
my $res = $sth->execute( $event->{Id} )
|
my $res = $sth->execute( $Event->{Id} )
|
||||||
or Error("Unable to execute '$sql': ".$dbh->errstr());
|
or Error("Unable to execute '$sql': ".$dbh->errstr());
|
||||||
}
|
}
|
||||||
if ( $Config{ZM_OPT_FFMPEG} && $filter->{AutoVideo} ) {
|
if ( $Config{ZM_OPT_FFMPEG} && $filter->{AutoVideo} ) {
|
||||||
if ( !$event->{Videoed} ) {
|
if ( !$Event->{Videoed} ) {
|
||||||
$delete_ok = undef if !generateVideo($filter, $event);
|
$delete_ok = undef if !generateVideo($filter, $Event);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if ( $Config{ZM_OPT_EMAIL} && $filter->{AutoEmail} ) {
|
if ( $Config{ZM_OPT_EMAIL} && $filter->{AutoEmail} ) {
|
||||||
if ( !$event->{Emailed} ) {
|
if ( !$Event->{Emailed} ) {
|
||||||
$delete_ok = undef if !sendEmail($filter, $Event);
|
$delete_ok = undef if !sendEmail($filter, $Event);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if ( $Config{ZM_OPT_MESSAGE} && $filter->{AutoMessage} ) {
|
if ( $Config{ZM_OPT_MESSAGE} && $filter->{AutoMessage} ) {
|
||||||
if ( !$event->{Messaged} ) {
|
if ( !$Event->{Messaged} ) {
|
||||||
$delete_ok = undef if !sendMessage($filter, $Event);
|
$delete_ok = undef if !sendMessage($filter, $Event);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if ( $Config{ZM_OPT_UPLOAD} && $filter->{AutoUpload} ) {
|
if ( $Config{ZM_OPT_UPLOAD} && $filter->{AutoUpload} ) {
|
||||||
if ( !$event->{Uploaded} ) {
|
if ( !$Event->{Uploaded} ) {
|
||||||
$delete_ok = undef if !uploadArchFile($filter, $Event);
|
$delete_ok = undef if !uploadArchFile($filter, $Event);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if ( $filter->{AutoExecute} ) {
|
if ( $filter->{AutoExecute} ) {
|
||||||
if ( !$event->{Executed} ) {
|
if ( !$Event->{Executed} ) {
|
||||||
$delete_ok = undef if !executeCommand($filter, $event);
|
$delete_ok = undef if !executeCommand($filter, $Event);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if ( $filter->{AutoDelete} ) {
|
if ( $filter->{AutoDelete} ) {
|
||||||
if ( $delete_ok ) {
|
if ( $delete_ok ) {
|
||||||
$Event->delete();
|
$Event->delete();
|
||||||
} else {
|
} else {
|
||||||
Error("Unable toto delete event $event->{Id} as previous operations failed");
|
Error("Unable to delete event $Event->{Id} as previous operations failed");
|
||||||
}
|
}
|
||||||
} # end if AutoDelete
|
} # end if AutoDelete
|
||||||
|
|
||||||
|
@ -364,11 +364,11 @@ sub checkFilter {
|
||||||
|
|
||||||
sub generateVideo {
|
sub generateVideo {
|
||||||
my $filter = shift;
|
my $filter = shift;
|
||||||
my $event = shift;
|
my $Event = shift;
|
||||||
my $phone = shift;
|
my $phone = shift;
|
||||||
|
|
||||||
my $rate = $event->{DefaultRate}/100;
|
my $rate = $Event->{DefaultRate}/100;
|
||||||
my $scale = $event->{DefaultScale}/100;
|
my $scale = $Event->{DefaultScale}/100;
|
||||||
my $format;
|
my $format;
|
||||||
|
|
||||||
my @ffmpeg_formats = split(/\s+/, $Config{ZM_FFMPEG_FORMATS});
|
my @ffmpeg_formats = split(/\s+/, $Config{ZM_FFMPEG_FORMATS});
|
||||||
|
@ -393,7 +393,7 @@ sub generateVideo {
|
||||||
my $command = join('',
|
my $command = join('',
|
||||||
$Config{ZM_PATH_BIN},
|
$Config{ZM_PATH_BIN},
|
||||||
'/zmvideo.pl -e ',
|
'/zmvideo.pl -e ',
|
||||||
$event->{Id},
|
$Event->{Id},
|
||||||
' -r ',
|
' -r ',
|
||||||
$rate,
|
$rate,
|
||||||
' -s ',
|
' -s ',
|
||||||
|
@ -417,7 +417,7 @@ sub generateVideo {
|
||||||
my $sql = 'UPDATE Events SET Videoed = 1 WHERE Id = ?';
|
my $sql = 'UPDATE Events SET Videoed = 1 WHERE Id = ?';
|
||||||
my $sth = $dbh->prepare_cached($sql)
|
my $sth = $dbh->prepare_cached($sql)
|
||||||
or Fatal("Unable to prepare '$sql': ".$dbh->errstr());
|
or Fatal("Unable to prepare '$sql': ".$dbh->errstr());
|
||||||
my $res = $sth->execute($event->{Id})
|
my $res = $sth->execute($Event->{Id})
|
||||||
or Fatal("Unable to execute '$sql': ".$dbh->errstr());
|
or Fatal("Unable to execute '$sql': ".$dbh->errstr());
|
||||||
if ( wantarray() ) {
|
if ( wantarray() ) {
|
||||||
return( $format, $output );
|
return( $format, $output );
|
||||||
|
@ -467,15 +467,15 @@ sub generateImage {
|
||||||
|
|
||||||
sub uploadArchFile {
|
sub uploadArchFile {
|
||||||
my $filter = shift;
|
my $filter = shift;
|
||||||
my $event = shift;
|
my $Event = shift;
|
||||||
|
|
||||||
if ( ! $Config{ZM_UPLOAD_HOST} ) {
|
if ( ! $Config{ZM_UPLOAD_HOST} ) {
|
||||||
Error('Cannot upload archive as no upload host defined');
|
Error('Cannot upload archive as no upload host defined');
|
||||||
return( 0 );
|
return( 0 );
|
||||||
}
|
}
|
||||||
|
|
||||||
my $archFile = $event->{MonitorName}.'-'.$event->{Id};
|
my $archFile = $Event->{MonitorName}.'-'.$Event->{Id};
|
||||||
my $archImagePath = $event->Path()
|
my $archImagePath = $Event->Path()
|
||||||
.'/'
|
.'/'
|
||||||
.(
|
.(
|
||||||
( $Config{ZM_UPLOAD_ARCH_ANALYSE} )
|
( $Config{ZM_UPLOAD_ARCH_ANALYSE} )
|
||||||
|
@ -540,7 +540,7 @@ sub uploadArchFile {
|
||||||
return( 0 );
|
return( 0 );
|
||||||
} else {
|
} else {
|
||||||
if ( $Config{ZM_UPLOAD_PROTOCOL} eq 'ftp' ) {
|
if ( $Config{ZM_UPLOAD_PROTOCOL} eq 'ftp' ) {
|
||||||
Info('Uploading to '.$Config{ZM_UPLOAD_HOST}." using FTP");
|
Info('Uploading to '.$Config{ZM_UPLOAD_HOST}.' using FTP');
|
||||||
my $ftp = Net::FTP->new(
|
my $ftp = Net::FTP->new(
|
||||||
$Config{ZM_UPLOAD_HOST},
|
$Config{ZM_UPLOAD_HOST},
|
||||||
Timeout=>$Config{ZM_UPLOAD_TIMEOUT},
|
Timeout=>$Config{ZM_UPLOAD_TIMEOUT},
|
||||||
|
@ -565,7 +565,7 @@ sub uploadArchFile {
|
||||||
} else {
|
} else {
|
||||||
my $host = $Config{ZM_UPLOAD_HOST};
|
my $host = $Config{ZM_UPLOAD_HOST};
|
||||||
$host .= ':'.$Config{ZM_UPLOAD_PORT} if $Config{ZM_UPLOAD_PORT};
|
$host .= ':'.$Config{ZM_UPLOAD_PORT} if $Config{ZM_UPLOAD_PORT};
|
||||||
Info('Uploading to '.$host." using SFTP\n");
|
Info('Uploading to '.$host.' using SFTP');
|
||||||
my %sftpOptions = (
|
my %sftpOptions = (
|
||||||
host=>$Config{ZM_UPLOAD_HOST}, user=>$Config{ZM_UPLOAD_USER}
|
host=>$Config{ZM_UPLOAD_HOST}, user=>$Config{ZM_UPLOAD_USER}
|
||||||
($Config{ZM_UPLOAD_PASS} ? (password=>$Config{ZM_UPLOAD_PASS}) : ()),
|
($Config{ZM_UPLOAD_PASS} ? (password=>$Config{ZM_UPLOAD_PASS}) : ()),
|
||||||
|
@ -593,7 +593,7 @@ sub uploadArchFile {
|
||||||
my $sql = 'UPDATE Events SET Uploaded = 1 WHERE Id = ?';
|
my $sql = 'UPDATE Events SET Uploaded = 1 WHERE Id = ?';
|
||||||
my $sth = $dbh->prepare_cached($sql)
|
my $sth = $dbh->prepare_cached($sql)
|
||||||
or Fatal("Unable to prepare '$sql': ".$dbh->errstr());
|
or Fatal("Unable to prepare '$sql': ".$dbh->errstr());
|
||||||
my $res = $sth->execute($event->{Id})
|
my $res = $sth->execute($Event->{Id})
|
||||||
or Fatal("Unable to execute '$sql': ".$dbh->errstr());
|
or Fatal("Unable to execute '$sql': ".$dbh->errstr());
|
||||||
}
|
}
|
||||||
return 1;
|
return 1;
|
||||||
|
@ -949,13 +949,13 @@ sub sendMessage {
|
||||||
|
|
||||||
sub executeCommand {
|
sub executeCommand {
|
||||||
my $filter = shift;
|
my $filter = shift;
|
||||||
my $event = shift;
|
my $Event = shift;
|
||||||
|
|
||||||
my $event_path = $event->Path();
|
my $event_path = $Event->Path();
|
||||||
|
|
||||||
my $command = $filter->{AutoExecuteCmd};
|
my $command = $filter->{AutoExecuteCmd};
|
||||||
$command .= " $event_path";
|
$command .= " $event_path";
|
||||||
$command = substituteTags($command, $filter, $event);
|
$command = substituteTags($command, $filter, $Event);
|
||||||
|
|
||||||
Info("Executing '$command'");
|
Info("Executing '$command'");
|
||||||
my $output = qx($command);
|
my $output = qx($command);
|
||||||
|
@ -971,7 +971,7 @@ sub executeCommand {
|
||||||
my $sql = 'UPDATE Events SET Executed = 1 WHERE Id = ?';
|
my $sql = 'UPDATE Events SET Executed = 1 WHERE Id = ?';
|
||||||
my $sth = $dbh->prepare_cached($sql)
|
my $sth = $dbh->prepare_cached($sql)
|
||||||
or Fatal("Unable to prepare '$sql': ".$dbh->errstr());
|
or Fatal("Unable to prepare '$sql': ".$dbh->errstr());
|
||||||
my $res = $sth->execute( $event->{Id} )
|
my $res = $sth->execute( $Event->{Id} )
|
||||||
or Fatal("Unable to execute '$sql': ".$dbh->errstr());
|
or Fatal("Unable to execute '$sql': ".$dbh->errstr());
|
||||||
}
|
}
|
||||||
return( 1 );
|
return( 1 );
|
||||||
|
|
|
@ -23,7 +23,7 @@ case $i in
|
||||||
shift # past argument=value
|
shift # past argument=value
|
||||||
;;
|
;;
|
||||||
-d=*|--distro=*)
|
-d=*|--distro=*)
|
||||||
DISTRO="${i#*=}"
|
DISTROS="${i#*=}"
|
||||||
shift # past argument=value
|
shift # past argument=value
|
||||||
;;
|
;;
|
||||||
-i=*|--interactive=*)
|
-i=*|--interactive=*)
|
||||||
|
@ -74,11 +74,15 @@ else
|
||||||
echo "Doing $TYPE build"
|
echo "Doing $TYPE build"
|
||||||
fi;
|
fi;
|
||||||
|
|
||||||
if [ "$DISTRO" == "" ]; then
|
if [ "$DISTROS" == "" ]; then
|
||||||
DISTRO=`lsb_release -a 2>/dev/null | grep Codename | awk '{print $2}'`;
|
if [ "$RELEASE" != "" ]; then
|
||||||
echo "Defaulting to $DISTRO for distribution";
|
DISTROS="xenial,bionic,trusty"
|
||||||
else
|
else
|
||||||
echo "Building for $DISTRO";
|
DISTROS=`lsb_release -a 2>/dev/null | grep Codename | awk '{print $2}'`;
|
||||||
|
fi;
|
||||||
|
echo "Defaulting to $DISTROS for distribution";
|
||||||
|
else
|
||||||
|
echo "Building for $DISTROS";
|
||||||
fi;
|
fi;
|
||||||
|
|
||||||
# Release is a special mode... it uploads to the release ppa and cannot have a snapshot
|
# Release is a special mode... it uploads to the release ppa and cannot have a snapshot
|
||||||
|
@ -116,6 +120,18 @@ else
|
||||||
fi;
|
fi;
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
PPA="";
|
||||||
|
if [ "$RELEASE" != "" ]; then
|
||||||
|
# We need to use our official tarball for the original source, so grab it and overwrite our generated one.
|
||||||
|
IFS='.' read -r -a VERSION <<< "$RELEASE"
|
||||||
|
PPA="ppa:iconnor/zoneminder-${VERSION[0]}.${VERSION[1]}"
|
||||||
|
else
|
||||||
|
if [ "$BRANCH" == "" ]; then
|
||||||
|
PPA="ppa:iconnor/zoneminder-master";
|
||||||
|
else
|
||||||
|
PPA="ppa:iconnor/zoneminder-$BRANCH";
|
||||||
|
fi;
|
||||||
|
fi;
|
||||||
|
|
||||||
# Instead of cloning from github each time, if we have a fork lying around, update it and pull from there instead.
|
# Instead of cloning from github each time, if we have a fork lying around, update it and pull from there instead.
|
||||||
if [ ! -d "${GITHUB_FORK}_zoneminder_release" ]; then
|
if [ ! -d "${GITHUB_FORK}_zoneminder_release" ]; then
|
||||||
|
@ -154,6 +170,11 @@ if [ "$SNAPSHOT" != "stable" ] && [ "$SNAPSHOT" != "" ]; then
|
||||||
fi;
|
fi;
|
||||||
|
|
||||||
DIRECTORY="zoneminder_$VERSION";
|
DIRECTORY="zoneminder_$VERSION";
|
||||||
|
if [ -d "$DIRECTORY.orig" ]; then
|
||||||
|
echo "$DIRECTORY.orig already exists. Please delete it."
|
||||||
|
exit 0;
|
||||||
|
fi;
|
||||||
|
|
||||||
echo "Doing $TYPE release $DIRECTORY";
|
echo "Doing $TYPE release $DIRECTORY";
|
||||||
mv "${GITHUB_FORK}_zoneminder_release" "$DIRECTORY.orig";
|
mv "${GITHUB_FORK}_zoneminder_release" "$DIRECTORY.orig";
|
||||||
if [ $? -ne 0 ]; then
|
if [ $? -ne 0 ]; then
|
||||||
|
@ -161,6 +182,7 @@ if [ $? -ne 0 ]; then
|
||||||
echo "Setting up build dir failed.";
|
echo "Setting up build dir failed.";
|
||||||
exit $?;
|
exit $?;
|
||||||
fi;
|
fi;
|
||||||
|
|
||||||
cd "$DIRECTORY.orig";
|
cd "$DIRECTORY.orig";
|
||||||
|
|
||||||
# Init submodules
|
# Init submodules
|
||||||
|
@ -172,17 +194,26 @@ rm -rf .git
|
||||||
rm .gitignore
|
rm .gitignore
|
||||||
cd ../
|
cd ../
|
||||||
|
|
||||||
|
if [ ! -e "$DIRECTORY.orig.tar.gz" ]; then
|
||||||
tar zcf $DIRECTORY.orig.tar.gz $DIRECTORY.orig
|
tar zcf $DIRECTORY.orig.tar.gz $DIRECTORY.orig
|
||||||
|
fi;
|
||||||
|
|
||||||
|
IFS=',' ;for DISTRO in `echo "$DISTROS"`; do
|
||||||
|
echo "Generating package for $DISTRO";
|
||||||
cd $DIRECTORY.orig
|
cd $DIRECTORY.orig
|
||||||
|
|
||||||
|
if [ -e "debian" ]; then
|
||||||
|
rm -rf debian
|
||||||
|
fi;
|
||||||
|
|
||||||
# Generate Changlog
|
# Generate Changlog
|
||||||
if [ "$DISTRO" == "trusty" ] || [ "$DISTRO" == "precise" ]; then
|
if [ "$DISTRO" == "trusty" ] || [ "$DISTRO" == "precise" ]; then
|
||||||
mv distros/ubuntu1204 debian
|
cp -Rpd distros/ubuntu1204 debian
|
||||||
else
|
else
|
||||||
if [ "$DISTRO" == "wheezy" ]; then
|
if [ "$DISTRO" == "wheezy" ]; then
|
||||||
mv distros/debian debian
|
cp -Rpd distros/debian debian
|
||||||
else
|
else
|
||||||
mv distros/ubuntu1604 debian
|
cp -Rpd distros/ubuntu1604 debian
|
||||||
fi;
|
fi;
|
||||||
fi;
|
fi;
|
||||||
|
|
||||||
|
@ -254,7 +285,7 @@ fi;
|
||||||
if [ "$DEBSIGN_KEYID" != "" ]; then
|
if [ "$DEBSIGN_KEYID" != "" ]; then
|
||||||
DEBUILD="$DEBUILD -k$DEBSIGN_KEYID"
|
DEBUILD="$DEBUILD -k$DEBSIGN_KEYID"
|
||||||
fi
|
fi
|
||||||
$DEBUILD
|
eval $DEBUILD
|
||||||
if [ $? -ne 0 ]; then
|
if [ $? -ne 0 ]; then
|
||||||
echo "Error status code is: $?"
|
echo "Error status code is: $?"
|
||||||
echo "Build failed.";
|
echo "Build failed.";
|
||||||
|
@ -262,13 +293,6 @@ echo "Error status code is: $?"
|
||||||
fi;
|
fi;
|
||||||
|
|
||||||
cd ../
|
cd ../
|
||||||
if [ "$INTERACTIVE" != "no" ]; then
|
|
||||||
read -p "Do you want to keep the checked out version of Zoneminder (incase you want to modify it later) [y/N]"
|
|
||||||
[[ $REPLY == [yY] ]] && { mv "$DIRECTORY.orig" zoneminder_release; echo "The checked out copy is preserved in zoneminder_release"; } || { rm -fr "$DIRECTORY.orig"; echo "The checked out copy has been deleted"; }
|
|
||||||
echo "Done!"
|
|
||||||
else
|
|
||||||
rm -fr "$DIRECTORY.orig"; echo "The checked out copy has been deleted";
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [ $TYPE == "binary" ]; then
|
if [ $TYPE == "binary" ]; then
|
||||||
if [ "$INTERACTIVE" != "no" ]; then
|
if [ "$INTERACTIVE" != "no" ]; then
|
||||||
|
@ -291,24 +315,6 @@ if [ $TYPE == "binary" ]; then
|
||||||
fi;
|
fi;
|
||||||
else
|
else
|
||||||
SC="zoneminder_${VERSION}-${DISTRO}${PACKAGE_VERSION}_source.changes";
|
SC="zoneminder_${VERSION}-${DISTRO}${PACKAGE_VERSION}_source.changes";
|
||||||
PPA="";
|
|
||||||
if [ "$RELEASE" != "" ]; then
|
|
||||||
# We need to use our official tarball for the original source, so grab it and overwrite our generated one.
|
|
||||||
if [ ! -e "$RELEASE.tar.gz" ]; then
|
|
||||||
echo "Grabbing official source tarball from github."
|
|
||||||
wget "https://github.com/ZoneMinder/zoneminder/archive/$RELEASE.tar.gz"
|
|
||||||
fi;
|
|
||||||
echo "Overwriting generated zoneminder_${VERSION}.orig.tar.gz with source tarball from github";
|
|
||||||
cp "$RELEASE.tar.gz" "zoneminder_${VERSION}.orig.tar.gz"
|
|
||||||
IFS='.' read -r -a VERSION <<< "$RELEASE"
|
|
||||||
PPA="ppa:iconnor/zoneminder-${VERSION[0]}.${VERSION[1]}"
|
|
||||||
else
|
|
||||||
if [ "$BRANCH" == "" ]; then
|
|
||||||
PPA="ppa:iconnor/zoneminder-master";
|
|
||||||
else
|
|
||||||
PPA="ppa:iconnor/zoneminder-$BRANCH";
|
|
||||||
fi;
|
|
||||||
fi;
|
|
||||||
|
|
||||||
dput="Y";
|
dput="Y";
|
||||||
if [ "$INTERACTIVE" != "no" ]; then
|
if [ "$INTERACTIVE" != "no" ]; then
|
||||||
|
@ -318,5 +324,14 @@ else
|
||||||
fi;
|
fi;
|
||||||
fi;
|
fi;
|
||||||
fi;
|
fi;
|
||||||
|
done; # foreach distro
|
||||||
|
|
||||||
|
if [ "$INTERACTIVE" != "no" ]; then
|
||||||
|
read -p "Do you want to keep the checked out version of Zoneminder (incase you want to modify it later) [y/N]"
|
||||||
|
[[ $REPLY == [yY] ]] && { mv "$DIRECTORY.orig" zoneminder_release; echo "The checked out copy is preserved in zoneminder_release"; } || { rm -fr "$DIRECTORY.orig"; echo "The checked out copy has been deleted"; }
|
||||||
|
echo "Done!"
|
||||||
|
else
|
||||||
|
rm -fr "$DIRECTORY.orig"; echo "The checked out copy has been deleted";
|
||||||
|
fi
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -107,21 +107,19 @@ class HostController extends AppController {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
$zm_dir_events = $this->Config->find('list', array(
|
$zm_dir_events = ZM_DIR_EVENTS;
|
||||||
'conditions' => array('Name' => 'ZM_DIR_EVENTS'),
|
|
||||||
'fields' => array('Name', 'Value')
|
|
||||||
));
|
|
||||||
$zm_dir_events = $zm_dir_events['ZM_DIR_EVENTS' ];
|
|
||||||
|
|
||||||
// Test to see if $zm_dir_events is relative or absolute
|
// Test to see if $zm_dir_events is relative or absolute
|
||||||
if ('/' === "" || strrpos($zm_dir_events, '/', -strlen($zm_dir_events)) !== TRUE) {
|
#if ('/' === "" || strrpos($zm_dir_events, '/', -strlen($zm_dir_events)) !== TRUE) {
|
||||||
|
if ( substr($zm_dir_events, 0, 1) != '/' ) {
|
||||||
// relative - so add the full path
|
// relative - so add the full path
|
||||||
$zm_dir_events = Configure::read('ZM_PATH_WEB') . '/' . $zm_dir_events;
|
$zm_dir_events = ZM_PATH_WEB . '/' . $zm_dir_events;
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( $mid ) {
|
if ( $mid ) {
|
||||||
// Get disk usage for $mid
|
// Get disk usage for $mid
|
||||||
$usage = shell_exec ("du -sh0 $zm_dir_events/$mid | awk '{print $1}'");
|
Logger::Debug("Executing du -s0 $zm_dir_events/$mid | awk '{print $1}'");
|
||||||
|
$usage = shell_exec("du -s0 $zm_dir_events/$mid | awk '{print $1}'");
|
||||||
} else {
|
} else {
|
||||||
$monitors = $this->Monitor->find('all', array(
|
$monitors = $this->Monitor->find('all', array(
|
||||||
'fields' => array('Id', 'Name', 'WebColour')
|
'fields' => array('Id', 'Name', 'WebColour')
|
||||||
|
|
|
@ -0,0 +1,157 @@
|
||||||
|
<?php
|
||||||
|
App::uses('AppController', 'Controller');
|
||||||
|
/**
|
||||||
|
* Storage Controller
|
||||||
|
*
|
||||||
|
* @property Storage $Storage
|
||||||
|
* @property PaginatorComponent $Paginator
|
||||||
|
*/
|
||||||
|
class StorageController extends AppController {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Components
|
||||||
|
*
|
||||||
|
* @var array
|
||||||
|
*/
|
||||||
|
public $components = array('Paginator', 'RequestHandler');
|
||||||
|
|
||||||
|
public function beforeFilter() {
|
||||||
|
parent::beforeFilter();
|
||||||
|
global $user;
|
||||||
|
$canView = (!$user) || ($user['System'] != 'None');
|
||||||
|
if ( !$canView ) {
|
||||||
|
throw new UnauthorizedException(__('Insufficient Privileges'));
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* index method
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function index() {
|
||||||
|
$this->Storage->recursive = 0;
|
||||||
|
|
||||||
|
$options = '';
|
||||||
|
$storage_areas = $this->Storage->find('all',$options);
|
||||||
|
$this->set(array(
|
||||||
|
'storage' => $storage_areas,
|
||||||
|
'_serialize' => array('storage')
|
||||||
|
));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* view method
|
||||||
|
*
|
||||||
|
* @throws NotFoundException
|
||||||
|
* @param string $id
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function view($id = null) {
|
||||||
|
$this->Storage->recursive = 0;
|
||||||
|
if (!$this->Storage->exists($id)) {
|
||||||
|
throw new NotFoundException(__('Invalid storage area'));
|
||||||
|
}
|
||||||
|
$restricted = '';
|
||||||
|
|
||||||
|
$options = array('conditions' => array(
|
||||||
|
array('Storage.' . $this->Storage->primaryKey => $id),
|
||||||
|
$restricted
|
||||||
|
)
|
||||||
|
);
|
||||||
|
$storage = $this->Storage->find('first', $options);
|
||||||
|
$this->set(array(
|
||||||
|
'storage' => $storage,
|
||||||
|
'_serialize' => array('storage')
|
||||||
|
));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* add method
|
||||||
|
*
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function add() {
|
||||||
|
if ( $this->request->is('post') ) {
|
||||||
|
|
||||||
|
global $user;
|
||||||
|
$canEdit = (!$user) || ($user['System'] == 'Edit');
|
||||||
|
if ( !$canEdit ) {
|
||||||
|
throw new UnauthorizedException(__('Insufficient privileges'));
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
$this->Storage->create();
|
||||||
|
if ( $this->Storage->save($this->request->data) ) {
|
||||||
|
# Might be nice to send it a start request
|
||||||
|
#$this->daemonControl($this->Storage->id, 'start', $this->request->data);
|
||||||
|
return $this->flash(__('The storage area has been saved.'), array('action' => 'index'));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* edit method
|
||||||
|
*
|
||||||
|
* @throws NotFoundException
|
||||||
|
* @param string $id
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function edit($id = null) {
|
||||||
|
$this->Storage->id = $id;
|
||||||
|
|
||||||
|
global $user;
|
||||||
|
$canEdit = (!$user) || ($user['System'] == 'Edit');
|
||||||
|
if ( !$canEdit ) {
|
||||||
|
throw new UnauthorizedException(__('Insufficient privileges'));
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ( !$this->Storage->exists($id) ) {
|
||||||
|
throw new NotFoundException(__('Invalid storage area'));
|
||||||
|
}
|
||||||
|
if ( $this->Storage->save($this->request->data) ) {
|
||||||
|
$message = 'Saved';
|
||||||
|
} else {
|
||||||
|
$message = 'Error';
|
||||||
|
}
|
||||||
|
|
||||||
|
$this->set(array(
|
||||||
|
'message' => $message,
|
||||||
|
'_serialize' => array('message')
|
||||||
|
));
|
||||||
|
// - restart this storage area after change
|
||||||
|
#$this->daemonControl($this->Storage->id, 'restart', $this->request->data);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* delete method
|
||||||
|
*
|
||||||
|
* @throws NotFoundException
|
||||||
|
* @param string $id
|
||||||
|
* @return void
|
||||||
|
*/
|
||||||
|
public function delete($id = null) {
|
||||||
|
global $user;
|
||||||
|
$canEdit = (!$user) || ($user['System'] == 'Edit');
|
||||||
|
if ( !$canEdit ) {
|
||||||
|
throw new UnauthorizedException(__('Insufficient privileges'));
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
$this->Storage->id = $id;
|
||||||
|
if ( !$this->Storage->exists() ) {
|
||||||
|
throw new NotFoundException(__('Invalid storage area'));
|
||||||
|
}
|
||||||
|
$this->request->allowMethod('post', 'delete');
|
||||||
|
|
||||||
|
#$this->daemonControl($this->Storage->id, 'stop');
|
||||||
|
|
||||||
|
if ( $this->Storage->delete() ) {
|
||||||
|
return $this->flash(__('The storage area has been deleted.'), array('action' => 'index'));
|
||||||
|
} else {
|
||||||
|
return $this->flash(__('The storage area could not be deleted. Please, try again.'), array('action' => 'index'));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -19,7 +19,7 @@
|
||||||
|
|
||||||
.overlayHeader {
|
.overlayHeader {
|
||||||
float: left;
|
float: left;
|
||||||
background-color: #dddddd;
|
background-color: #853131;
|
||||||
width: 100%;
|
width: 100%;
|
||||||
border-bottom: 1px solid #666666;
|
border-bottom: 1px solid #666666;
|
||||||
color: black;
|
color: black;
|
||||||
|
|
|
@ -547,7 +547,7 @@ private $control_fields = array(
|
||||||
} // end function Source
|
} // end function Source
|
||||||
|
|
||||||
public function Url() {
|
public function Url() {
|
||||||
return $this->Server()->Url() .':'. ( ZM_MIN_STREAMING_PORT ? (ZM_MIN_STREAMING_PORT+$this->Id()) : $_SERVER['SERVER_PORT'] );
|
return $this->Server()->Url( ZM_MIN_STREAMING_PORT ? (ZM_MIN_STREAMING_PORT+$this->Id()) : null );
|
||||||
}
|
}
|
||||||
|
|
||||||
} // end class Monitor
|
} // end class Monitor
|
||||||
|
|
|
@ -38,13 +38,18 @@ class Server {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public function Url() {
|
public function Url( $port = null ) {
|
||||||
|
$url = ZM_BASE_PROTOCOL . '://';
|
||||||
if ( $this->Id() ) {
|
if ( $this->Id() ) {
|
||||||
return ZM_BASE_PROTOCOL . '://'. $this->Hostname();
|
$url .= $this->Hostname();
|
||||||
} else {
|
} else {
|
||||||
return ZM_BASE_PROTOCOL . '://'. $_SERVER['SERVER_NAME'];
|
$url .= $_SERVER['SERVER_NAME'];
|
||||||
return '';
|
|
||||||
}
|
}
|
||||||
|
if ( $port ) {
|
||||||
|
$url .= ':'.$port;
|
||||||
|
}
|
||||||
|
$url .= $_SERVER['PHP_SELF'];
|
||||||
|
return $url;
|
||||||
}
|
}
|
||||||
public function Hostname() {
|
public function Hostname() {
|
||||||
if ( isset( $this->{'Hostname'} ) and ( $this->{'Hostname'} != '' ) ) {
|
if ( isset( $this->{'Hostname'} ) and ( $this->{'Hostname'} != '' ) ) {
|
||||||
|
|
|
@ -183,12 +183,13 @@ foreach ( getSkinIncludes('skin.php') as $includeFile )
|
||||||
require_once $includeFile;
|
require_once $includeFile;
|
||||||
|
|
||||||
if ( ZM_OPT_USE_AUTH ) {
|
if ( ZM_OPT_USE_AUTH ) {
|
||||||
if ( ZM_AUTH_HASH_LOGINS ) {
|
if ( ZM_AUTH_HASH_LOGINS && empty($user) && ! empty($_REQUEST['auth']) ) {
|
||||||
if ( empty($user) && ! empty($_REQUEST['auth']) ) {
|
|
||||||
if ( $authUser = getAuthUser($_REQUEST['auth']) ) {
|
if ( $authUser = getAuthUser($_REQUEST['auth']) ) {
|
||||||
userLogin($authUser['Username'], $authUser['Password'], true);
|
userLogin($authUser['Username'], $authUser['Password'], true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
else if ( isset($_REQUEST['username']) and isset($_REQUEST['password']) ) {
|
||||||
|
userLogin($_REQUEST['username'], $_REQUEST['password'], false);
|
||||||
}
|
}
|
||||||
if ( !empty($user) ) {
|
if ( !empty($user) ) {
|
||||||
// generate it once here, while session is open. Value will be cached in session and return when called later on
|
// generate it once here, while session is open. Value will be cached in session and return when called later on
|
||||||
|
|
|
@ -1,2 +1,3 @@
|
||||||
User-agent: *
|
User-agent: *
|
||||||
Disallow: /
|
Disallow: /
|
||||||
|
###
|
Loading…
Reference in New Issue