summaryrefslogtreecommitdiffstats
path: root/abs/core/zoneminder/zoneminder.install
diff options
context:
space:
mode:
Diffstat (limited to 'abs/core/zoneminder/zoneminder.install')
-rw-r--r--[-rwxr-xr-x]abs/core/zoneminder/zoneminder.install139
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: