summaryrefslogtreecommitdiffstats
path: root/abs/core/xymon/xymon.install
blob: 067030ee167d13ede7e1305d013daf798f580bc0 (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
post_install() {
	. /etc/systemconfig
	if  [ ! -f   /data/srv/xymon/server/ext/ignoreclient.py ]
	then
		echo "#this is a list of hosts to ignore" >  /data/srv/xymon/server/ext/ignoreclient.py
		echo ignorehosts=\"\'ignoreme1\',\'ignoreme2\'\" >> /data/srv/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/" /data/srv/xymon/server/etc/hosts.cfg
	sed -i -e "s/\#/\# func/" /data/srv/xymon/server/etc/hosts.cfg
	sed -i -e "s/localhost/$hostname/" /data/srv/xymon/server/etc/xymonserver.cfg
	chown -R nobody /data/srv/xymon
	chown -R nobody /data/srv/httpd/htdocs/xymon
	chown -R nobody /var/log/hobbit
	chown root /data/srv/xymon/server/bin/xymonping
	chmod +s /data/srv/xymon/server/bin/xymonping
  echo "Adding sudo permissions for nobody {certmaster-ca}"
  echo "Adding sudo permissions for http {backup_job}"
  echo "Adding sudo permissions for http {sv}"
  LINE="nobody    ALL = NOPASSWD:/usr/bin/certmaster-ca"
  LINE1="http    ALL = NOPASSWD:/usr/LH/bin/lh_system_backup_job"
  LINE2="http    ALL = NOPASSWD:/sbin/sv"
        setfacl -R -m u:nobody:rwx /data/srv/httpd/htdocs 
  for i in "$LINE"  "$LINE1" "$LINE2"
  do
          cp /etc/sudoers /etc/sudoers.bak
          grep -q "$i" /etc/sudoers
          if [ $? != 0 ]
          then
                  echo  "$i" >> /etc/sudoers
                  visudo -cf /etc/sudoers
                  if [ ! $? = 0 ]
                  then
                          cp /etc/sudoers.bak /etc/sudoers
                          echo $i
                          echo "Error adding files"
                          exit 1
                  fi
          fi
  done
  
  



}

post_upgrade() {
  post_install $1
}

post_remove() {
 rm -f /data/srv/httpd/htdocs/xymon/index.html
}

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