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}" LINE="nobody ALL = NOPASSWD:/usr/bin/certmaster-ca" LINE1="http ALL = NOPASSWD:/usr/MythVantage/bin/backup_job" for i in "$LINE" "$LINE1" 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