summaryrefslogtreecommitdiffstats
path: root/abs/core/xymon/xymon-server.install
blob: 7c08bd3e3e2fdcffbc8eba8a5092c5a732de39a7 (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
post_install() {
    . /etc/systemconfig
    if  [ ! -f   /home/xymon/server/ext/ignoreclient.py ]
    then
        echo "#this is a list of hosts to ignore" >  /home/xymon/server/ext/ignoreclient.py
        echo ignorehosts=\"\'ignoreme1\',\'ignoreme2\'\" >> /home/xymon/server/ext/ignoreclient.py
    fi

    if  [ ! -f  /data/srv/httpd/htdocs/failed_func_hosts ]
    then
        touch /data/srv/httpd/htdocs/failed_func_hosts
    fi
    chown nobody:nobody /data/srv/httpd/htdocs/failed_func_hosts
    chmod 777 /data/srv/httpd/htdocs/failed_func_hosts

    sed -i -e "s/localhost/$hostname/" /home/xymon/server/etc/hosts.cfg
    sed -i -e "s/\# bbd/\# bbd func/" /home/xymon/server/etc/hosts.cfg
    sed -i -e "s/localhost/$hostname/" /home/xymon/server/etc/xymonserver.cfg

    #fix permissions
    chown -R nobody:nobody /home/xymon
    chown -R nobody:nobody /data/srv/httpd/htdocs/xymon
    #added so py bindings work with /home/mythtv/.mythtv/config.xml
    setfacl -m "u:nobody:--x" /home/mythtv/

    chown -R nobody:http /data/srv/httpd/htdocs/xymon/snap
    chown -R nobody:http /data/srv/httpd/htdocs/xymon/rep
    chmod -R 775   /data/srv/httpd/htdocs/xymon/rep
    chmod -R 775   /data/srv/httpd/htdocs/xymon/snap

    chmod g+s /data/srv/httpd/htdocs/xymon/notes/
    setfacl -d -m g::rw /data/srv/httpd/htdocs/xymon/notes/
    setfacl -d -m u:nobody:rwx /data/srv/httpd/htdocs/xymon/notes/

    file="/data/srv/httpd/htdocs/xymon/gifs/network.png"
    if [ -f $file ]
    then
        setfacl -m u:nobody:rw $file
    fi
    
    setfacl -d -m u:nobody:rwx /data/srv/httpd/htdocs/xymon/gifs/

    chmod g+s /home/xymon/etc
    setfacl -d -m g::rw /home/xymon/etc/
    setfacl -d -m u::rw /home/xymon/etc/
    setfacl -d -m u:nobody:rwx /home/xymon/etc/
    
    file="/home/xymon/etc/mythdot"
    if [ -f $file ]
    then
        setfacl -m u:nobody:rw $file
    fi
 
    chown -R nobody /var/log/hobbit

    chown root /home/xymon/server/bin/xymonping
    chmod +s /home/xymon/server/bin/xymonping

    #remove old mtc log files
    rm -f /var/log/hobbit/mtc
    rm -f /var/log/hobbit/mtc.1*

    echo "Generate lighttpd include..."
    gen_light_include.py
    echo "Forcing a re-read of lighttpd's configuration file..."
    sv hup /service/lighttpd
}

post_upgrade() {
    post_install $1
}

post_remove() {
    rm -f /data/srv/httpd/htdocs/xymon/index.html
    echo "Generate lighttpd include..."
    gen_light_include.py
    echo "Forcing a re-read of lighttpd's configuration file..."
    sv hup /service/lighttpd
}

pre_remove() {
    /bin/true
}
op=$1
shift
$op $*
# vim: ft=sh ts=2