[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#630043: use dpkg --force-unsafe-io if available



Package: live-build
Version: 3.0~a18-1
Severity: wishlist
Tags: patch
User: ubuntu-devel@lists.ubuntu.com
Usertags: origin-ubuntu ubuntu-patch oneiric

The --force-unsafe-io option was introduced in dpkg 1.15.8.6 (see
#584254).  It's useful for cases where it doesn't matter if unpacked
files are properly preserved across power failures, and live image
builds were one of the main use cases we were thinking about: in the
case of an interrupted live image build, you'd just 'lb clean' and start
again.  Thus, it seems sensible to use it across the board if it's
available.  Patch attached.

Thanks,

-- 
Colin Watson                                       [cjwatson@ubuntu.com]
>From b94c12fdc9a2a19b52317181316c5fe0f5b7584e Mon Sep 17 00:00:00 2001
From: Colin Watson <cjwatson@canonical.com>
Date: Fri, 10 Jun 2011 15:57:32 +0100
Subject: [PATCH] Use dpkg --force-unsafe-io if available.

---
 scripts/build/lb_chroot_dpkg |   11 +++++++++++
 1 files changed, 11 insertions(+), 0 deletions(-)

diff --git a/scripts/build/lb_chroot_dpkg b/scripts/build/lb_chroot_dpkg
index 64c8085..819dbda 100755
--- a/scripts/build/lb_chroot_dpkg
+++ b/scripts/build/lb_chroot_dpkg
@@ -53,6 +53,14 @@ EOF
 
 		chmod 755 chroot/sbin/start-stop-daemon
 
+		# Disable dpkg syncing
+		if echo 'dpkg --compare-versions "$(dpkg-query -W --showformat="\${Version}" dpkg)" ge 1.15.8.6' | Chroot chroot sh
+		then
+			cat > chroot/etc/dpkg/dpkg.cfg.d/live-build << EOF
+force-unsafe-io
+EOF
+		fi
+
 		# Manual hacks for special packages
 
 		# samhain
@@ -95,6 +103,9 @@ EOF
 			mv chroot/sbin/start-stop-daemon.orig chroot/sbin/start-stop-daemon
 		fi
 
+		# Remove dpkg sync configuration
+		rm -f chroot/etc/dpkg/dpkg.cfg.d/live-build
+
 		# Removing stage file
 		rm -f .stage/chroot_dpkg
 		;;
-- 
1.7.5.3


Reply to: