Index: trunk/packages/invirt-dev/debian/changelog
===================================================================
--- trunk/packages/invirt-dev/debian/changelog	(revision 1769)
+++ trunk/packages/invirt-dev/debian/changelog	(revision 1770)
@@ -1,2 +1,8 @@
+invirt-dev (0.0.9) unstable; urgency=low
+
+  * Don't add the same line a bunch of times to /etc/sudoers
+
+ -- Evan Broder <broder@mit.edu>  Tue, 25 Nov 2008 08:16:17 -0500
+
 invirt-dev (0.0.8) unstable; urgency=low
 
Index: trunk/packages/invirt-dev/debian/invirt-dev.postinst
===================================================================
--- trunk/packages/invirt-dev/debian/invirt-dev.postinst	(revision 1769)
+++ trunk/packages/invirt-dev/debian/invirt-dev.postinst	(revision 1770)
@@ -9,5 +9,13 @@
             adduser --system repository
             addgroup --system repo
-            echo "%repo   ALL=(repository)        ALWAYS_SET_HOME,NOPASSWD: /usr/bin/reprepro" >>/etc/sudoers
+            
+            # Clean up the old sudoers block, then add it back
+            perl -i.bak -ne 's%^### (BEGIN|END) invirt-dev\s*$%%m && ($skip = ($1 eq "BEGIN")); print unless $skip;' /etc/sudoers
+            
+            cat >>/etc/sudoers <<EOF
+### BEGIN invirt-dev
+%repo   ALL=(repository)        ALWAYS_SET_HOME,NOPASSWD: /usr/bin/reprepro
+### END invirt-dev
+EOF
             echo "-----"
             echo "invirt-dev: run"
