From 7279cd5152033f4d20b55392559581a8df72b66f Mon Sep 17 00:00:00 2001
From: James Meyer <james.meyer@operamail.com>
Date: Wed, 15 Aug 2012 11:08:05 -0500
Subject: xymon: python2

---
 abs/core/xymon/PKGBUILD            | 46 +++++++++++++++++++-------------------
 abs/core/xymon/hbfunc.py           |  2 +-
 abs/core/xymon/hbnotes.py          |  2 +-
 abs/core/xymon/hobbit_myth_data.py |  2 +-
 abs/core/xymon/hobbitadd.py        |  2 +-
 abs/core/xymon/hobbitstorage.py    |  2 +-
 abs/core/xymon/xymon-server.rules  |  5 +++++
 abs/core/xymon/xymon.install       | 24 --------------------
 8 files changed, 33 insertions(+), 52 deletions(-)
 create mode 100644 abs/core/xymon/xymon-server.rules

diff --git a/abs/core/xymon/PKGBUILD b/abs/core/xymon/PKGBUILD
index 622623e..14b7574 100644
--- a/abs/core/xymon/PKGBUILD
+++ b/abs/core/xymon/PKGBUILD
@@ -8,7 +8,7 @@ arch=('i686' 'x86_64')
 
 url="http://www.xymon.com/"
 
-source=(http://voxel.dl.sourceforge.net/project/xymon/Xymon/4.3.5/xymon-4.3.5.tar.gz  hobbitadd.py xymon_ghost_check graph.cfg.diff xymonserver.cfg.diff tasks.d.mv clientlaunch.cfg.patch hobbitstorage.py  hbnotes.py hobbit-myth-orphan.sh  analysis.cfg hbfunc.py be.png tuner.png tv.png  hobbit-mem-myth.sh hobbit_notify.sh alerts.cfg hobbit_myth_data.py logrotate-server.xymon logrotate-client.xymon log_list.sh client-local.cfg.patch led_themes.tar.gz )
+source=(http://voxel.dl.sourceforge.net/project/xymon/Xymon/4.3.5/xymon-4.3.5.tar.gz  hobbitadd.py xymon_ghost_check graph.cfg.diff xymonserver.cfg.diff tasks.d.mv clientlaunch.cfg.patch hobbitstorage.py  hbnotes.py hobbit-myth-orphan.sh  analysis.cfg hbfunc.py be.png tuner.png tv.png  hobbit-mem-myth.sh hobbit_notify.sh alerts.cfg hobbit_myth_data.py logrotate-server.xymon logrotate-client.xymon log_list.sh client-local.cfg.patch led_themes.tar.gz xymon-server.rules)
 
 depends=(rrdtool fping pcre python2 graphviz 'linhes-scripts>=7-24')
 
@@ -52,6 +52,7 @@ package_xymonserver(){
       cd $startdir/src/xymon-$pkgver
       make PKGBUILD=1 INSTALLROOT=$startdir/pkg/xymonserver install
       cd $startdir/src
+      install -D -m400 $startdir/src/xymon-server.rules $startdir/pkg/xymonserver/etc/sudoers.d/xymon_server
       install -D -m755 $startdir/src/hobbitadd.py  $startdir/pkg/xymonserver/data/srv/xymon/server/bin/hobbitadd.py
       install -D -m755 $startdir/src/hobbitstorage.py  $startdir/pkg/xymonserver/data/srv/xymon/server/ext/hobbitstorage.py
       install -D -m755 $startdir/src/hobbit-myth-orphan.sh $startdir/pkg/xymonserver/data/srv/xymon/server/ext/hobbit-myth-orphan.sh
@@ -61,7 +62,6 @@ package_xymonserver(){
       install -D -m755 $startdir/src/hobbit-mem-myth.sh $startdir/pkg/xymonserver/data/srv/xymon/server/ext/hobbit-mem-myth.sh
       install -D -m755 $startdir/src/log_list.sh $startdir/pkg/xymonserver/data/srv/xymon/client/bin/log_list.sh
 
-#      install -D -m755  xymon_ghost_check $startdir/pkg/xymonserver/etc/cron.tenminutes/xymon_ghost_check
       install  -m755 analysis.cfg $startdir/pkg/xymonserver/data/srv/xymon/etc/analysis.cfg
       cat alerts.cfg >> $startdir/pkg/xymonserver/data/srv/xymon/etc/alerts.cfg
 
@@ -78,61 +78,61 @@ package_xymonserver(){
       cd $startdir/src/themes
       cp -fp Common/* $DOCDIR/gifs/
       cp -fp ModernLED/* $DOCDIR/gifs/
-    #apply patches to conf file
-#      mkdir -p $startdir/pkg/xymonserver/data/srv/xymon/etc/tasks.d/
-#      mkdir -p $startdir/pkg/xymonserver/data/srv/xymon/etc/tasks.d/
-       install -D -m755 $startdir/src/tasks.d.mv $startdir/pkg/xymonserver/data/srv/xymon/etc/tasks.d/mv.cfg
-#       cat  $startdir/src/tasks.d.mv >>  $startdir/pkg/xymonserver/data/srv/xymon/etc/tasks.cfg
+      #apply patches to conf file
+      install -D -m775 $startdir/src/tasks.d.mv $startdir/pkg/xymonserver/data/srv/xymon/etc/tasks.d/mv.cfg
       cd $startdir/pkg/xymonserver/data/srv/xymon/etc
       patch -p0 <  $startdir/src/graph.cfg.diff || return 1 
       patch -p0 <  $startdir/src/xymonserver.cfg.diff || return 1
       patch -p4 < $startdir/src/client-local.cfg.patch || return 1
 
-
-
+      #fix permissions
+      chmod 775 $startdir/pkg/xymonserver/data/srv/httpd/htdocs/
+      chmod 775 $startdir/pkg/xymonserver/data/srv/httpd/htdocs/xymon/
+      chmod 775 $startdir/pkg/xymonserver/data/srv/httpd/htdocs/xymon/notes/
+      chmod 775 $startdir/pkg/xymonserver/data/srv/httpd/htdocs/xymon/gifs/
+      chmod 750 $startdir/pkg/xymonserver/etc/sudoers.d
     }
 
 
 package_xymonclient(){
     #create client package as well
     depends=()
-     backup=('data/srv/xymon/client/etc/xymonclient.cfg')
+    backup=('data/srv/xymon/client/etc/xymonclient.cfg')
     install=xymon-client.install
 
-     install -D -m755 $startdir/src/log_list.sh $startdir/pkg/xymonclient/data/srv/xymon/client/bin/log_list.sh
+    install -D -m755 $startdir/src/log_list.sh $startdir/pkg/xymonclient/data/srv/xymon/client/bin/log_list.sh
     install -D  -m644 $startdir/src/logrotate-client.xymon $startdir/pkg/xymonclient/etc/logrotate.d/xymon-client
     install -D -m755 $startdir/src/hobbit-mem-myth.sh $startdir/pkg/xymonclient/data/srv/xymon/client/ext/hobbit-mem-myth.sh
     cp -rp /$startdir/pkg/xymonserver/data/srv/xymon/client/ $startdir/pkg/xymonclient/data/srv/xymon/
 
-     cd -
-     cd $startdir/pkg/xymonclient/data/srv/xymon/client/etc
-     patch -p0 <  $startdir/src/clientlaunch.cfg.patch
-     cd -
-
-
+    cd -
+    cd $startdir/pkg/xymonclient/data/srv/xymon/client/etc
+    patch -p0 <  $startdir/src/clientlaunch.cfg.patch
+    cd -
     }
 
 md5sums=('31923ec126fe1c264fceb459d2175161'
-         '28399d002ace27f01c6cfee3edd407ee'
+         'a18fac7a450846ca609cdb39e32a613a'
          '0f79d9715a827fa845a114b74b2c190c'
          'a45dd4cdb84817bcf3e51b25cc713799'
          '034658a1084510ecbbb0dc166c0401eb'
          'cc845b5aedc33dda8e3103b915fe4967'
          '650b523d879f32c1bad3b4a9e10e7c93'
-         '093648dabb0d1da0fdcc37b327737f43'
-         'cac3478de106d875ddbdaa377d26692d'
+         'b2f98ac0df013332deedc1efae0a270d'
+         'c455faa46cbf4178d191ba6ab62527f5'
          '0f70e76a164f648f0a4a01110137cb20'
          'f6921f0413215ae174e81306be80d37f'
-         'be02f5d21373f97224ffa4727ec9718a'
+         '9f5deee017753d970ccc16486533c420'
          'd210c43fb9ee9ad6cd7648e0c2e0efea'
          '0c808fa12672289f86b0651545381308'
          '0469d775db9fdd18ea95dd41937ada82'
          '0757294eec13771f8e63da23cf066796'
          '622f400fd098cbc43c203e3210a6694e'
          'd06c4327cc69aeead3fa05f39660f33e'
-         'eb502ce1be9b658be74911b53832caa8'
+         '388dbe22d97198af0cd0bf1d18e96ce5'
          'f6ff1fb4bacee930007b877424619b30'
          'e06147db25d75cf246886137a4ea164a'
          '98e9242ae346f729b14cb195786571f2'
          '40fa09bdb1ae60f3fe767f1c6a979b65'
-         'c7178bbf384bbe86c318b60fef6faf10')
+         'c7178bbf384bbe86c318b60fef6faf10'
+         'fd14b6ebdee25d29ea6caf226e26362d')
diff --git a/abs/core/xymon/hbfunc.py b/abs/core/xymon/hbfunc.py
index 39e1680..60d0bde 100644
--- a/abs/core/xymon/hbfunc.py
+++ b/abs/core/xymon/hbfunc.py
@@ -1,4 +1,4 @@
-#!/usr/bin/python
+#!/usr/bin/python2
 #checks that the MBE can connect to the minions
 
 # ===============================================
diff --git a/abs/core/xymon/hbnotes.py b/abs/core/xymon/hbnotes.py
index 2a1b221..ddf0ab4 100644
--- a/abs/core/xymon/hbnotes.py
+++ b/abs/core/xymon/hbnotes.py
@@ -1,4 +1,4 @@
-#!/usr/bin/python
+#!/usr/bin/python2
 # -*- coding: utf-8 -*-
 # import MySQL module
 
diff --git a/abs/core/xymon/hobbit_myth_data.py b/abs/core/xymon/hobbit_myth_data.py
index 1acca67..62a6a49 100644
--- a/abs/core/xymon/hobbit_myth_data.py
+++ b/abs/core/xymon/hobbit_myth_data.py
@@ -1,4 +1,4 @@
-#!/usr/bin/python
+#!/usr/bin/python2
 # checks for the number of days of guide data left
 # make sure myth_mtc ran ok
 
diff --git a/abs/core/xymon/hobbitadd.py b/abs/core/xymon/hobbitadd.py
index cb2fbed..91963a4 100644
--- a/abs/core/xymon/hobbitadd.py
+++ b/abs/core/xymon/hobbitadd.py
@@ -1,4 +1,4 @@
-#!/usr/bin/python
+#!/usr/bin/python2
 #polls the hobbit server for ghost clients.  If it finds ghosts it will make a new bb-hosts file
 #with the new clients.
 #Will not add duplicate clients
diff --git a/abs/core/xymon/hobbitstorage.py b/abs/core/xymon/hobbitstorage.py
index e79f8d1..a82adcb 100644
--- a/abs/core/xymon/hobbitstorage.py
+++ b/abs/core/xymon/hobbitstorage.py
@@ -1,4 +1,4 @@
-#!/usr/bin/python
+#!/usr/bin/python2
 # import MySQL module
 
 import MySQLdb
diff --git a/abs/core/xymon/xymon-server.rules b/abs/core/xymon/xymon-server.rules
new file mode 100644
index 0000000..be7b4dd
--- /dev/null
+++ b/abs/core/xymon/xymon-server.rules
@@ -0,0 +1,5 @@
+#These rules are used by xymon-server
+nobody    ALL = NOPASSWD:/usr/bin/certmaster-ca
+http    ALL = NOPASSWD:/usr/LH/bin/lh_system_backup_job
+http    ALL = NOPASSWD:/sbin/sv
+
diff --git a/abs/core/xymon/xymon.install b/abs/core/xymon/xymon.install
index 067030e..ec5e242 100644
--- a/abs/core/xymon/xymon.install
+++ b/abs/core/xymon/xymon.install
@@ -22,30 +22,6 @@ post_install() {
 	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
   
   
 
-- 
cgit v0.12

