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
invirt-base (0.0.29) unstable; urgency=low
+ [ Greg Brockman ]
* Added a safestructs for doing config without raising.
- -- Greg Brockman <gdb@mit.edu> 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 <broder@mit.edu> Wed, 27 Jan 2010 21:18:07 -0500
invirt-base (0.0.28) unstable; urgency=low
;;
triggered)
- invirt-reload
+ if dpkg --compare-versions "$DPKG_RUNNING_VERSION" ge '1.14.5ubuntu10~~'; then
+ invirt-reload
+ else
+ DPKG_MAINTSCRIPT_PACKAGE='' invirt-reload
+ fi
;;
*)
#!/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