check-mk (1.1.12p7-1) 02_wato-sudoers

Summary

 setup.sh |   26 +++++---------------------
 1 file changed, 5 insertions(+), 21 deletions(-)

    
download this patch

Patch contents

#! /bin/sh /usr/share/dpatch/dpatch-run
## wato-sudoers-location.dpatch by Bernd Zeimetz <bzed@debian.org>
##
## All lines beginning with `## DP:' are a description of the patch.
## DP: Install WATO sudoers line into /etc/sudoers.d/check_mk_WATO

@DPATCH@
diff -urNad '--exclude=CVS' '--exclude=.svn' '--exclude=.git' '--exclude=.arch' '--exclude=.hg' '--exclude=_darcs' '--exclude=.bzr' pkg-check-mk~/setup.sh pkg-check-mk/setup.sh
--- pkg-check-mk~/setup.sh	2011-11-10 09:50:10.000000000 +0100
+++ pkg-check-mk/setup.sh	2011-11-10 09:50:56.207820998 +0100
@@ -571,28 +571,12 @@
 	return
     fi
  
-    sudolines="Defaults:$wwwuser !requiretty\n$wwwuser ALL = (root) NOPASSWD: $bindir/check_mk --automation *"
-
-    if [ ! -e /etc/sudoers ] ; then
-        echo "You do not have sudo installed. Please install sudo "
-        echo "and add the following line to /etc/sudoers if you want"
-        echo "to use WATO - the Check_MK Web Administration Tool"
-        echo
-        echo -e "$sudolines"
-        echo 
-        echo
-        return
-    fi
-
-    if fgrep -q 'check_mk --automation' /etc/sudoers 2>/dev/null
-    then
-        # already present. Do not touch.
-        return
-    fi
+    sudolines="Defaults:$wwwuser !requiretty\n$wwwuser ALL = (nagios) NOPASSWD: $bindir/check_mk --automation *"
 
-    echo >> /etc/sudoers
-    echo "# Needed for  WATO - the Check_MK Web Administration Tool" >> /etc/sudoers
-    echo -e "$sudolines" >> /etc/sudoers
+    mkdir -p $DESTDIR/etc/sudoers.d
+    echo >> $DESTDIR/etc/sudoers.d/check_mk_wato
+    echo "# Needed for  WATO - the Check_MK Web Administration Tool" >> $DESTDIR/etc/sudoers.d/check_mk_wato
+    echo -e "$sudolines" >> $DESTDIR/etc/sudoers.d/check_mk_wato
 }
 
 while true