summaryrefslogtreecommitdiffstats
path: root/abs/core/zoneminder/zoneminder.install
blob: db07ef4a7f8df0ab90777d50d1632f46e9c01deb (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
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
    }

post_install() {

    systemd-tmpfiles --create zoneminder.conf

    #---LinHES Stuff
    usermod -G video http
    install_db
    gen_light_include.py
    /sbin/sv hup /service/lighttpd
    #---

    echo "To start zoneminder enter:"
    echo "    sudo add_service.sh zoneminder"
}

post_upgrade() {
    post_install
    /usr/bin/zmupdate.pl -f >/dev/null
}

post_remove() {
    if [[ -d /tmp/zoneminder ]]; then
        rm -vr /tmp/zoneminder
    fi

    #---LinHES Stuff
    gen_light_include.py
    /sbin/sv hup /service/lighttpd
    #--
}