summaryrefslogtreecommitdiff
path: root/pcr/zoneminder/zoneminder.install
diff options
context:
space:
mode:
Diffstat (limited to 'pcr/zoneminder/zoneminder.install')
-rw-r--r--pcr/zoneminder/zoneminder.install121
1 files changed, 82 insertions, 39 deletions
diff --git a/pcr/zoneminder/zoneminder.install b/pcr/zoneminder/zoneminder.install
index be449a5ca..3ade5355e 100644
--- a/pcr/zoneminder/zoneminder.install
+++ b/pcr/zoneminder/zoneminder.install
@@ -1,57 +1,100 @@
-# zoneminder.install
+pre_install() {
+ set -e
+ abort=false
+ if [ -L /usr/share/zoneminder/events ]; then
+ l=$(readlink /usr/share/zoneminder/events)
+ if [ $l != /var/cache/zoneminder/events ]; then
+ abort=true
+ fi
+ fi
+ if [ -L /usr/share/zoneminder/images ]; then
+ l=$(readlink /usr/share/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
+/usr/share/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
+ exit 1
+ fi
+ exit 0
+}
-## 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
- mkdir /srv/zoneminder/backup
- mkdir /srv/zoneminder/socks
+ mkdir /usr/share/zoneminder/backup
+ mkdir /usr/share/zoneminder/socks
cat << EOF
Note:
-==> To initialize the ZoneMinder database run (as root)
-==> /srv/zoneminder/bin/zminit
-EOF
+==> To run Zoneminder, you must install the database running mysql service (as root):
+==> "rc.d start mysqld" (in initscripts) or "systemctl start mysqld.service" (in systemd)
+==> and add Zoneminder database typing:
+==> mysqladmin --defaults-file=/etc/mysql/my.cnf -p -f reload
+==> cat /usr/share/zoneminder/db/zm_create.sql | mysql --defaults-file=/etc/mysql/my.cnf -p
+==> echo 'grant lock tables, alter,select,insert,update,delete on zm.*'"\
+==> "' to 'zmuser'@localhost identified by "zmpass";' |
+==> mysql --defaults-file=/etc/mysql/my.cnf -p mysql"
- 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
-EOF
- cat << EOF
-==> Check /etc/php/php.ini and make sure short_open_tag = On
-EOF
+Note:
+==> You must uncomment that line in /etc/php/php.ini:
+==> "extension=mysql.so"
+==> check and make sure these are uncommented:
+==> "extension=gd.so"
+==> "extension=gettext.so"
+==> "extension=mcrypt.so"
+==> "extension=mysqli.so"
+==> "extension=session.so"
+==> "extension=sockets.so"
+==> Check /etc/php/php.ini and make sure short_open_tag = On
+==> or ZoneMinder will not work.
- cat /etc/php/php.ini |grep "^open_basedir.*/etc/" | \
-grep "/srv/zoneminder/www">/dev/null || cat << EOF
-==> You must edit /etc/php/php.ini and add to open_basedir "/etc/" and
-==> "/srv/zoneminder/" like so
-==> open_basedir = /home/:/tmp/:/usr/share/pear/:/etc/:/srv/zoneminder/
+==> You must edit /etc/php/php.ini and add to open_basedir "/etc" and
+==> "/usr/share/zoneminder" like so
+==> open_basedir = /home:/tmp:/usr/share/pear:/etc:/usr/share/zoneminder
==> Otherwise ZoneMinder will be unable to read /etc/zm.conf
==> or display its own web directory
-EOF
- cat << EOF
Note:
-==> You must edit /etc/httpd/conf/httpd.conf and uncomment/add the line
+==> You must edit /etc/httpd/conf/httpd.conf and add the line:
==> LoadModule php5_module modules/libphp5.so
-==> You must also add these lines:
-==> Include conf/extra/php5_module.conf
+==> and:
==> Include /etc/httpd/conf/extra/httpd-zm.conf
EOF
- touch /srv/zoneminder/zm_backup.sql
}
-
-## arg 1: the new package version
-## arg 2: the old package version
post_upgrade() {
- /srv/zoneminder/bin/zmupdate.pl -f >/dev/null
+ /usr/bin/zmupdate.pl -f >/dev/null
+}
+
+post_remove() {
+ cat << EOF
+Note:
+==> To clean Zoneminder mysql database, run as root:
+==> "echo 'delete from user where User="zmuser";' | mysql --defaults-file=/etc/mysql/my.cnf -p mysql"
+==> "echo 'delete from db where User="zmuser";' | mysql --defaults-file=/etc/mysql/my.cnf -p mysql"
+==> "mysqladmin --defaults-file=/etc/mysql/my.cnf -p -f drop zm"
+
+==> Disable http with php if it isn't needed with others servers,
+==> comment or remove that lines in /etc/httpd/conf/httpd.conf:
+==> "LoadModule php5_module modules/libphp5.so"
+==> "Include /etc/httpd/conf/extra/httpd-zm.conf"
+
+==> Disable php with mysql if it isn't needed with others servers,
+==> comment that lines in /etc/php/php.ini:
+==> "extension=mysql.so"
+==> "extension=gd.so"
+==> "extension=gettext.so"
+==> "extension=mcrypt.so"
+==> "extension=mysqli.so"
+==> "extension=session.so"
+==> "extension=sockets.so"
+
+==> edit /etc/php/php.ini and remove "/etc" and "/usr/share/zoneminder"
+==> in the open_basedir.
+EOF
}
-# vim:set ts=2 sw=2 et: