blob: c2e1cb82ec22a2be02420662edc69052c283a759 (
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
98
99
100
101
102
|
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
}
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
exit 1
fi
exit 0
}
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
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
#--
}
|