#! /bin/sh /usr/share/dpatch/dpatch-run ## wato-sudoers-location.dpatch by Bernd Zeimetz ## ## 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 2013-08-07 11:44:12.000000000 +0200 +++ pkg-check-mk/setup.sh 2013-08-07 11:47:40.344748346 +0200 @@ -718,28 +718,11 @@ 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 - - echo >> /etc/sudoers - echo "# Needed for WATO - the Check_MK Web Administration Tool" >> /etc/sudoers - echo -e "$sudolines" >> /etc/sudoers + sudolines="Defaults:$wwwuser !requiretty\n$wwwuser ALL = (nagios) NOPASSWD: $bindir/check_mk --automation *" + 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