From: Evan Broder Date: Thu, 28 Jan 2010 02:53:16 +0000 (-0500) Subject: Add code to invirt-reload to de-duplicate multiple invocations. (LP: #439426) X-Git-Tag: 0.0.29^0 X-Git-Url: http://xvm.mit.edu/gitweb/invirt/packages/invirt-base.git/commitdiff_plain/refs/tags/0.0.29?hp=30641d7872dd5f494c965b4d9f01e8d8910dc4f4 Add code to invirt-reload to de-duplicate multiple invocations. (LP: #439426) This uses the dpkg triggers mechanism to de-duplicate multiple invocations of invirt-reload over the course of a single dpkg run. The code is largely lifted from Ubuntu's update-initramfs. svn path=/trunk/packages/invirt-base/; revision=2941 --- diff --git a/debian/changelog b/debian/changelog index dda2cdb..3d3f987 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,8 +1,13 @@ invirt-base (0.0.29) unstable; urgency=low + [ Greg Brockman ] * Added a safestructs for doing config without raising. - -- Greg Brockman Tue, 19 Jan 2010 23:49:19 -0500 + [ Evan Broder ] + * Support running invirt-reload directly from a package postinst, + instead of via triggers. (LP: #439426) + + -- Evan Broder Wed, 27 Jan 2010 21:18:07 -0500 invirt-base (0.0.28) unstable; urgency=low diff --git a/debian/invirt-base.postinst b/debian/invirt-base.postinst index a2ae96f..73ea19b 100755 --- a/debian/invirt-base.postinst +++ b/debian/invirt-base.postinst @@ -26,7 +26,11 @@ case "$1" in ;; triggered) - invirt-reload + if dpkg --compare-versions "$DPKG_RUNNING_VERSION" ge '1.14.5ubuntu10~~'; then + invirt-reload + else + DPKG_MAINTSCRIPT_PACKAGE='' invirt-reload + fi ;; *) diff --git a/scripts/invirt-reload b/scripts/invirt-reload index 75e9503..84dbe7a 100755 --- a/scripts/invirt-reload +++ b/scripts/invirt-reload @@ -1,5 +1,14 @@ #!/bin/bash +if [ "$DPKG_MAINTSCRIPT_PACKAGE" != '' ] && \ + [ $# = 0 ] && \ + dpkg-trigger --check-supported 2>/dev/null; then + if dpkg-trigger --no-await invirt-base; then + echo "invirt-reload: deferring update (trigger activated)" + exit 0 + fi +fi + for script in $(run-parts --test /etc/init.d); do if [ "${script#/etc/init.d/invirt-}" != "$script" ]; then invoke-rc.d "${script#/etc/init.d/}" force-reload