summaryrefslogtreecommitdiff
path: root/pcr/zoneminder/zoneminder.install
blob: 922aaad9bfd3b0179edb4e02bf2af94798451525 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
pre_install() {
  set -e
  abort=false
  if [ -L /usr/share/zoneminder/www/events ]; then
    l=$(readlink /usr/share/zoneminder/www/events)
    if [ $l != /var/cache/zoneminder/events ]; then
        abort=true
    fi
  fi
  if [ -L /usr/share/zoneminder/www/images ]; then
    l=$(readlink /usr/share/zoneminder/www/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/www 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
}

post_install() {
  mkdir /usr/share/zoneminder/www/backup
  mkdir /usr/share/zoneminder/www/socks
  cat << EOF
Note:
==> 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"

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"

==> 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/www"
==> Otherwise ZoneMinder will be unable to read /etc/zm.conf
==> or display its own web directory

Note:
==> You must edit /etc/httpd/conf/httpd.conf and add the line:
==> "LoadModule php5_module modules/libphp5.so"
==> and:
==> "Include /etc/httpd/conf/extra/php5_module.conf"
==> "Include /etc/httpd/conf/extra/httpd-zm.conf"
EOF
}

post_upgrade() {
  /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/php5_module.conf"
==> "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/www"
==> in the open_basedir.
EOF
}