diff options
author | James Meyer <james.meyer@operamail.com> | 2012-11-01 20:57:51 (GMT) |
---|---|---|
committer | James Meyer <james.meyer@operamail.com> | 2012-11-01 20:57:51 (GMT) |
commit | e851f51157ac00aa3de03f4bb9743c6a7d91bea8 (patch) | |
tree | 9e8b5cc91129ce33d469c7be61c091b135b6aa93 /abs/core/zoneminder/zoneminder.install | |
parent | 8fefa501175bdcc7d250b27bf8475b55f79e03cd (diff) | |
download | linhes_pkgbuild-e851f51157ac00aa3de03f4bb9743c6a7d91bea8.zip linhes_pkgbuild-e851f51157ac00aa3de03f4bb9743c6a7d91bea8.tar.gz linhes_pkgbuild-e851f51157ac00aa3de03f4bb9743c6a7d91bea8.tar.bz2 |
zoneminder 1.25: made it easier for end users to get this product up and running.
It will not integrate itself with lighttpd and install the database.
runit-scripts holds the run file.
All that should be needed for this package to work is
add_service zoneminder
Then access the console at
http://localhost/zm
Unfortunatly only mythzoneminder on the backend will be able to use zoneminder. This is a shortcoming of the integration with myth and zoneminder.
Diffstat (limited to 'abs/core/zoneminder/zoneminder.install')
-rw-r--r--[-rwxr-xr-x] | abs/core/zoneminder/zoneminder.install | 139 |
1 files changed, 93 insertions, 46 deletions
diff --git a/abs/core/zoneminder/zoneminder.install b/abs/core/zoneminder/zoneminder.install index 250749f..c2e1cb8 100755..100644 --- a/abs/core/zoneminder/zoneminder.install +++ b/abs/core/zoneminder/zoneminder.install @@ -1,55 +1,102 @@ -# zoneminder.install -## arg 1: the new package version -post_install() { - ln -s /usr/share/cambozola/cambozola.jar /srv/zoneminder/www/ - chown -R http.http /srv/zoneminder - chown http.http /etc/zm.conf - cat << EOF -Note: -==> To initialize the ZoneMinder database run (as root) -==> /usr/lib/zm/bin/zminit -EOF +install_db() { + . /etc/systemconfig + if [ $SystemType = Master_backend -o $SystemType = Standalone ] + then + mysql -e "use zm" > /dev/null + rc=$? + if [ $rc = 1 ] + then + echo "Installing zoneminder database zm" + cat /usr/share/zoneminder/db/zm_create.sql | mysql + echo 'grant lock tables, alter,select,insert,update,delete on zm.* to 'zmuser'@localhost identified by "zmpass";' | mysql + fi + else + echo "Will only init the database for StandAlone or Master_backend LinHES systems" + fi + } -cat << EOF -==> Check /etc/php/php.ini and make sure these are uncommented -==> extension=gd.so -==> extension=gettext.so -==> extension=mcrypt.so -==> extension=mysql.so -==> extension=mysqli.so -==> extension=session.so -==> extension=sockets.so +pre_install() { + set -e + abort=false + if [ -L /srv/http/zoneminder/events ]; then + l=$(readlink /srv/http/zoneminder/events) + if [ $l != /var/cache/zoneminder/events ]; then + abort=true + fi + fi + if [ -L /srv/http/zoneminder/images ]; then + l=$(readlink /srv/http/zoneminder/images) + if [ $l != /var/cache/zoneminder/images ]; then + abort=true + fi + fi + if [ $abort = true ]; then + cat >&2 << EOF +Aborting installation of zoneminder due to non-default symlinks in +/srv/http/zoneminder for the images and/or events directory, which could +result in loss of data. Please move your data in each of these directories to +/var/cache/zoneminder before installing zoneminder from the package. EOF -cat << EOF -==> Check /etc/php/php.ini and make sure short_open_tag = On -EOF - + exit 1 + fi + exit 0 +} -cat /etc/php/php.ini |grep "^open_basedir.*/etc/" | \ -grep "/var/lib/zm/www">/dev/null || cat << EOF -==> You must edit /etc/php/php.ini and add to open_basedir "/etc/" and -==> "/var/lib/zm/" like so -==> open_basedir = /home/:/tmp/:/usr/share/pear/:/etc/:/var/lib/zm/ -==> Otherwise ZoneMinder will be unable to read /etc/zm.conf -==> or display its own web directory -EOF +post_install() { + if [[ -d /var/log/zoneminder ]]; then + chmod 0755 /var/log/zoneminder + chown http.http /var/log/zoneminder + else + mkdir -m 0755 /var/log/zoneminder + chown http.http /var/log/zoneminder + fi + if [[ -d /tmp/zoneminder ]]; then + chmod 0700 /tmp/zoneminder + chown http.http /tmp/zoneminder + else + mkdir -m 0700 /tmp/zoneminder + chown http.http /tmp/zoneminder + fi +#--- + usermod -G video http + COUNT=`grep -c "zm.include" /etc/lighttpd/conf.include` + if [ $COUNT == 0 ] + then + echo "==> Adding zm.include to conf.include" + echo "include \"/etc/lighttpd/zm.include\"" >> /etc/lighttpd/conf.include + fi + echo + echo "==> Forcing a re-read of lighttpd's configuration file." + echo "" + /sbin/sv hup /service/lighttpd -cat << EOF -Note: -==> You must edit /etc/httpd/conf/httpd.conf and uncomment/add the line -==> LoadModule php5_module modules/libphp5.so -==> You must also add these lines: -==> Include conf/extra/php5_module.conf -==> Include /etc/httpd/conf/extra/httpd-zm.conf -EOF -touch /var/lib/zm/zm_backup.sql + install_db +#--- +} +post_upgrade() { + post_install + /usr/bin/zmupdate.pl -f >/dev/null } +post_remove() { + if [[ -d /tmp/zoneminder ]]; then + rm -vr /tmp/zoneminder + fi + +#-- + COUNT=`grep -c "zm.include" /etc/lighttpd/conf.include` + if [ $COUNT -gt 0 ] + then + echo "==> Removing zm.include from conf.include" + sed -i 's#include \"/etc/lighttpd/zm.include\"##' -i /etc/lighttpd/conf.include + fi + + + echo + echo "==> Forcing a re-read of lighttpd's configuration file." + echo "" + /sbin/sv hup /service/lighttpd +#-- -## arg 1: the new package version -## arg 2: the old package version -post_upgrade() { -/usr/lib/zm/bin/zmupdate.pl -f >/dev/null } -# vim:set ts=2 sw=2 et: |