[SCM] live-build branch, debian-next, updated. debian/2.0_a21-1-3-gc0114ac

Chris Lamb lamby at debian.org
Sun Aug 1 01:18:06 UTC 2010


The following commit has been merged in the debian-next branch:
commit c0114ac4c7e12c35c2d8f20e18441fe16360df42
Author: Chris Lamb <lamby at debian.org>
Date:   Sat Jul 31 21:15:31 2010 -0400

    Run chroot stage with /var/lib/dpkg mounted as a tmpfs
    
    Idea from Thomas Lange and FAI. Speedup in my testcase (standard image)
    is 3m00 => 2m50, probably much better improvements for the desktop image
    clients.
    
    Signed-off-by: Chris Lamb <lamby at debian.org>

diff --git a/scripts/build/chroot b/scripts/build/chroot
index 99f03db..96dbfe7 100755
--- a/scripts/build/chroot
+++ b/scripts/build/chroot
@@ -34,6 +34,7 @@ lh chroot_selinuxfs install ${*}
 lh chroot_sysfs install ${*}
 lh chroot_debianchroot install ${*}
 lh chroot_dpkg install ${*}
+lh chroot_dpkg_tmpfs install ${*}
 lh chroot_sysv-rc install ${*}
 lh chroot_upstart install ${*}
 lh chroot_hosts install ${*}
@@ -71,6 +72,7 @@ lh chroot_resolv remove ${*}
 lh chroot_hosts remove ${*}
 lh chroot_sysv-rc remove ${*}
 lh chroot_upstart remove ${*}
+lh chroot_dpkg_tmpfs remove ${*}
 lh chroot_dpkg remove ${*}
 lh chroot_debianchroot remove ${*}
 lh chroot_sysfs remove ${*}
diff --git a/scripts/build/chroot_debianchroot b/scripts/build/chroot_dpkg_tmpfs
similarity index 57%
copy from scripts/build/chroot_debianchroot
copy to scripts/build/chroot_dpkg_tmpfs
index ae37953..8d7e264 100755
--- a/scripts/build/chroot_debianchroot
+++ b/scripts/build/chroot_dpkg_tmpfs
@@ -1,6 +1,6 @@
 #!/bin/sh
 
-# lh_chroot_debianchroot(1) - manage /etc/debian_chroot
+# lh_chroot_dpkg_tmpfs(1) - manage tmpfs for /var/lib/dpkg
 # Copyright (C) 2006-2010 Daniel Baumann <daniel at debian.org>
 #
 # live-helper comes with ABSOLUTELY NO WARRANTY; for details see COPYING.
@@ -13,7 +13,7 @@ set -e
 . "${LH_BASE:-/usr/share/live-helper}"/scripts/build.sh
 
 # Setting static variables
-DESCRIPTION="$(Echo 'manage /etc/debian_chroot')"
+DESCRIPTION="$(Echo 'manage /var/lib/dpkg')"
 HELP=""
 USAGE="${PROGRAM} {install|remove} [--force]"
 
@@ -28,10 +28,10 @@ Require_stagefile .stage/config .stage/bootstrap
 
 case "${1}" in
 	install)
-		Echo_message "Configuring file /etc/debian_chroot"
+		Echo_message "Configuring tmpfs for /var/lib/dpkg"
 
 		# Checking stage file
-		Check_stagefile .stage/chroot_debianchroot
+		Check_stagefile .stage/chroot_dpkg_tmpfs
 
 		# Checking lock file
 		Check_lockfile .lock
@@ -39,21 +39,18 @@ case "${1}" in
 		# Creating lock file
 		Create_lockfile .lock
 
-		if [ -f chroot/etc/debian_chroot ]
-		then
-			# Save chroot file
-			mv chroot/etc/debian_chroot chroot/etc/debian_chroot.orig
-		fi
-
-		# Create chroot file
-		echo "live" > chroot/etc/debian_chroot
+		mv chroot/var/lib/dpkg chroot/var/lib/dpkg.tmp
+		mkdir chroot/var/lib/dpkg
+		mount -t tmpfs tmpfs chroot/var/lib/dpkg
+		mv chroot/var/lib/dpkg.tmp/* chroot/var/lib/dpkg
+		rm -rf chroot/var/lib/dpkg.tmp
 
 		# Creating stage file
-		Create_stagefile .stage/chroot_debianchroot
+		Create_stagefile .stage/chroot_dpkg_tmpfs
 		;;
 
 	remove)
-		Echo_message "Deconfiguring file /etc/debian_chroot"
+		Echo_message "Deconfiguring tmpfs for /var/lib/dpkg"
 
 		# Checking lock file
 		Check_lockfile .lock
@@ -61,17 +58,14 @@ case "${1}" in
 		# Creating lock file
 		Create_lockfile .lock
 
-		if [ -f chroot/etc/debian_chroot.orig ]
-		then
-			# Restore chroot file
-			mv chroot/etc/debian_chroot.orig chroot/etc/debian_chroot
-		else
-			# Remove chroot file
-			rm -f chroot/etc/debian_chroot
-		fi
+		mkdir -p chroot/var/lib/dpkg.tmp
+		mv chroot/var/lib/dpkg/* chroot/var/lib/dpkg.tmp
+		umount chroot/var/lib/dpkg
+		rm -rf chroot/var/lib/dpkg
+		mv chroot/var/lib/dpkg.tmp chroot/var/lib/dpkg
 
 		# Removing stage file
-		rm -f .stage/chroot_debianchroot
+		rm -f .stage/chroot_dpkg_tmpfs
 		;;
 
 	*)
diff --git a/scripts/build/clean b/scripts/build/clean
index 2df040c..13fc185 100755
--- a/scripts/build/clean
+++ b/scripts/build/clean
@@ -79,6 +79,7 @@ do
 			${LH_ROOT_COMMAND} umount -f chroot/dev/shm > /dev/null 2>&1 || true
 			${LH_ROOT_COMMAND} umount -f chroot/dev/pts > /dev/null 2>&1 || true
 			${LH_ROOT_COMMAND} umount -f chroot/dev > /dev/null 2>&1 || true
+			${LH_ROOT_COMMAND} umount -f chroot/var/lib/dpkg > /dev/null 2>&1 || true
 
 			${LH_ROOT_COMMAND} umount -f chroot/binary.tmp > /dev/null 2>&1 || true
 			${LH_ROOT_COMMAND} umount -f chroot/dev.tmp/pts > /dev/null 2>&1 || true

-- 
live-build



More information about the debian-live-changes mailing list