From: Evan Broder Date: Thu, 27 May 2010 15:58:35 +0000 (-0400) Subject: Use the .. Perl operator to simplify prerms. X-Git-Tag: 0.0.13~1 X-Git-Url: http://xvm.mit.edu/gitweb/invirt/packages/xvm-munin-config.git/commitdiff_plain/930b253816980ad014aaecef70ed6e9f5b4b6829 Use the .. Perl operator to simplify prerms. invirt-console-host, invirt-dev, and all of the packages in xvm-munin-config previously used a convoluted one-liner to clean up /etc/sudoers, but we can do it much more easily using the .. operator. Taken from http://blog.ksplice.com/2010/05/top-10-perl-one-liner-tricks/ svn path=/trunk/packages/xvm-munin-config/; revision=3011 --- diff --git a/debian/changelog b/debian/changelog index f7fc30e..4ac7abf 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,9 @@ +xvm-munin-config (0.0.12) unstable; urgency=low + + * Use the .. perl operator to simplify the prerms. + + -- Evan Broder Thu, 27 May 2010 11:55:31 -0400 + xvm-munin-config (0.0.11) unstable; urgency=low * Add missing invirt-base dependency to all xvm-munin-config packages. diff --git a/debian/xvm-munin-console-config.prerm b/debian/xvm-munin-console-config.prerm index 3306876..b8ba0ec 100755 --- a/debian/xvm-munin-console-config.prerm +++ b/debian/xvm-munin-console-config.prerm @@ -19,7 +19,7 @@ set -e case "$1" in remove|upgrade|deconfigure) - perl -i.bak -ne 's%^### (BEGIN|END) xvm-munin-config\s*$%%m && ($skip = ($1 eq "BEGIN")); print unless $skip;' /etc/sudoers + perl -i.bak -ne 'print unless /^### BEGIN xvm-munin-config/../^### END xvm-munin-config/' /etc/sudoers ;; failed-upgrade) diff --git a/debian/xvm-munin-host-config.prerm b/debian/xvm-munin-host-config.prerm index 3306876..b8ba0ec 100755 --- a/debian/xvm-munin-host-config.prerm +++ b/debian/xvm-munin-host-config.prerm @@ -19,7 +19,7 @@ set -e case "$1" in remove|upgrade|deconfigure) - perl -i.bak -ne 's%^### (BEGIN|END) xvm-munin-config\s*$%%m && ($skip = ($1 eq "BEGIN")); print unless $skip;' /etc/sudoers + perl -i.bak -ne 'print unless /^### BEGIN xvm-munin-config/../^### END xvm-munin-config/' /etc/sudoers ;; failed-upgrade) diff --git a/debian/xvm-munin-master-config.prerm b/debian/xvm-munin-master-config.prerm index 3306876..b8ba0ec 100755 --- a/debian/xvm-munin-master-config.prerm +++ b/debian/xvm-munin-master-config.prerm @@ -19,7 +19,7 @@ set -e case "$1" in remove|upgrade|deconfigure) - perl -i.bak -ne 's%^### (BEGIN|END) xvm-munin-config\s*$%%m && ($skip = ($1 eq "BEGIN")); print unless $skip;' /etc/sudoers + perl -i.bak -ne 'print unless /^### BEGIN xvm-munin-config/../^### END xvm-munin-config/' /etc/sudoers ;; failed-upgrade) diff --git a/debian/xvm-munin-remote-config.prerm b/debian/xvm-munin-remote-config.prerm index 3306876..b8ba0ec 100755 --- a/debian/xvm-munin-remote-config.prerm +++ b/debian/xvm-munin-remote-config.prerm @@ -19,7 +19,7 @@ set -e case "$1" in remove|upgrade|deconfigure) - perl -i.bak -ne 's%^### (BEGIN|END) xvm-munin-config\s*$%%m && ($skip = ($1 eq "BEGIN")); print unless $skip;' /etc/sudoers + perl -i.bak -ne 'print unless /^### BEGIN xvm-munin-config/../^### END xvm-munin-config/' /etc/sudoers ;; failed-upgrade)