Don't just keep adding to the sudoers file in xvm-munin-config
[invirt/packages/xvm-munin-config.git] / debian / xvm-munin-master-config.postinst
index 721e584..407cbef 100755 (executable)
@@ -23,6 +23,9 @@ case "$1" in
         # So munin can read the mail log
         adduser munin adm
         
+        # First clear out the old stuff we threw in /etc/sudoers
+        perl -i.bak -ne 's%^### (BEGIN|END) xvm-munin-config\s*$%%m && ($skip = ($1 eq "BEGIN")); print unless $skip;' /etc/sudoers
+        
         # So munin can sudo to get to postfix queue info
         cat >>/etc/sudoers <<EOF
 ### BEGIN xvm-munin-config