[Debian-live-changes] r1179 - in dists/trunk/live-helper: doc functions helpers

Daniel Baumann daniel at alioth.debian.org
Thu Apr 26 09:49:03 UTC 2007


Author: daniel
Date: 2007-04-26 09:49:03 +0000 (Thu, 26 Apr 2007)
New Revision: 1179

Modified:
   dists/trunk/live-helper/doc/ChangeLog
   dists/trunk/live-helper/functions/cache.sh
   dists/trunk/live-helper/functions/defaults.sh
   dists/trunk/live-helper/helpers/lh_bootstrap_cdebootstrap
   dists/trunk/live-helper/helpers/lh_bootstrap_debootstrap
   dists/trunk/live-helper/helpers/lh_config
Log:


Modified: dists/trunk/live-helper/doc/ChangeLog
===================================================================
--- dists/trunk/live-helper/doc/ChangeLog	2007-04-26 09:26:57 UTC (rev 1178)
+++ dists/trunk/live-helper/doc/ChangeLog	2007-04-26 09:49:03 UTC (rev 1179)
@@ -1,3 +1,10 @@
+2007-04-26  Daniel Baumann  <daniel at debian.org>
+
+	* helpers/*:
+	  - Implemented paranoid caching with LIVE_CACHE_INDICES,
+	    LIVE_CACHE_PACKAGES and LIVE_CACHE_STAGES. This allows to build
+	    images offline from the cache.
+
 2007-04-25  Daniel Baumann  <daniel at debian.org>
 
 	* helpers/lh_binary_usb, lh_source_usb:

Modified: dists/trunk/live-helper/functions/cache.sh
===================================================================
--- dists/trunk/live-helper/functions/cache.sh	2007-04-26 09:26:57 UTC (rev 1178)
+++ dists/trunk/live-helper/functions/cache.sh	2007-04-26 09:49:03 UTC (rev 1179)
@@ -13,7 +13,7 @@
 {
 	DIRECTORY="${1}"
 
-	if [ "${LH_CACHE}" = "enabled" ]
+	if [ "${LH_CACHE_PACKAGES}" = "enabled" ]
 	then
 		if [ -d "${DIRECTORY}" ]
 		then
@@ -27,7 +27,7 @@
 {
 	DIRECTORY="${1}"
 
-	if [ "${LH_CACHE}" = "enabled" ]
+	if [ "${LH_CACHE_PACKAGES}" = "enabled" ]
 	then
 		# Cleaning current cache
 		Chroot "apt-get autoclean"

Modified: dists/trunk/live-helper/functions/defaults.sh
===================================================================
--- dists/trunk/live-helper/functions/defaults.sh	2007-04-26 09:26:57 UTC (rev 1178)
+++ dists/trunk/live-helper/functions/defaults.sh	2007-04-26 09:49:03 UTC (rev 1179)
@@ -120,11 +120,21 @@
 	fi
 
 	# Setting cache option
-	if [ -z "${LH_CACHE}" ]
+	if [ -z "${LH_CACHE_INDICES}" ]
 	then
-		LH_CACHE="enabled"
+		LH_CACHE_INDICES="disabled"
 	fi
 
+	if [ -z "${LH_CACHE_PACKAGES}" ]
+	then
+		LH_CACHE_PACKAGES="enabled"
+	fi
+
+	if [ -z "${LH_CACHE_STAGES}" ]
+	then
+		LH_CACHE_STAGES="bootstrap"
+	fi
+
 	# Setting debconf frontend
 	if [ -z "${LH_DEBCONF_FRONTEND}" ]
 	then

Modified: dists/trunk/live-helper/helpers/lh_bootstrap_cdebootstrap
===================================================================
--- dists/trunk/live-helper/helpers/lh_bootstrap_cdebootstrap	2007-04-26 09:26:57 UTC (rev 1178)
+++ dists/trunk/live-helper/helpers/lh_bootstrap_cdebootstrap	2007-04-26 09:49:03 UTC (rev 1179)
@@ -91,12 +91,12 @@
 
 if [ -x "/usr/bin/cdebootstrap" ]
 then
-	if [ "${LH_CACHE}" = "enabled" ]
-	then
-		# Restore old cache
-		if [ -d cache/chroot_bootstrap ]
+	for STAGE in ${LIVE_CACHE_STAGES}
+	do
+		if [ "${STAGE}" = "bootstrap" ] && [ -d cache/stages_bootstrap ]
 		then
-			${LH_ROOT_COMMAND} cp -a cache/chroot_bootstrap/* chroot
+			# Restore old cache
+			${LH_ROOT_COMMAND} cp -a cache/stages_bootstrap/* chroot
 
 			if [ -n "${LH_ROOT_COMMAND}" ]
 			then
@@ -108,11 +108,14 @@
 
 			exit 0
 		fi
+	done
 
-		if [ -d cache/bootstrap ]
+	if [ "${LH_CACHE_PACKAGES}" = "enabled" ]
+	then
+		if [ -d cache/packages_bootstrap ]
 		then
 			mkdir -p chroot/var/cache/bootstrap
-			cp cache/bootstrap/*.deb chroot/var/cache/bootstrap
+			cp cache/packages_bootstrap/*.deb chroot/var/cache/bootstrap
 		fi
 
 		# Executing cdebootstrap (download-only)
@@ -124,18 +127,18 @@
 		fi
 
 		# Removing old cache
-		if [ -d cache/bootstrap ]
+		if [ -d cache/packages_bootstrap ]
 		then
-			rm -f cache/bootstrap/*.deb
+			rm -f cache/packages_bootstrap/*.deb
 		fi
 
 		# Saving new cache
-		if [ ! -d cache/bootstrap ]
+		if [ ! -d cache/packages_bootstrap ]
 		then
-			mkdir -p cache/bootstrap
+			mkdir -p cache/packages_bootstrap
 		fi
 
-		cp chroot/var/cache/bootstrap/*.deb cache/bootstrap
+		cp chroot/var/cache/bootstrap/*.deb cache/packages_bootstrap
 	fi
 
 	# Executing cdebootstrap (regular run)
@@ -158,26 +161,26 @@
 	rm -f chroot/etc/resolv.conf
 
 	# Removing bootstrap cache
-	if [ -d chroot/var/cache/bootstrap ]
-	then
-		rm -rf chroot/var/cache/bootstrap
-	fi
+	rm -rf chroot/var/cache/bootstrap
 
 	# Saving new cache
-	if [ "${LH_CACHE}" = "enabled" ]
-	then
-		if [ -d cache/chroot_bootstrap ]
+	for STAGE in ${LIVE_CACHE_STAGES}
+	do
+		if [ "${STAGE}" = "bootstrap" ]
 		then
-			rm -rf cache/chroot_bootstrap
-		fi
+			if [ -d cache/stages_bootstrap ]
+			then
+				rm -rf cache/stages_bootstrap
+			fi
 
-		${LH_ROOT_COMMAND} cp -a chroot cache/chroot_bootstrap
+			${LH_ROOT_COMMAND} cp -a chroot cache/stages_bootstrap
 
-		if [ -n "${LH_ROOT_COMMAND}" ]
-		then
-			${LH_ROOT_COMMAND} chown -R `whoami`:`whoami` cache/chroot_bootstrap
+			if [ -n "${LH_ROOT_COMMAND}" ]
+			then
+				${LH_ROOT_COMMAND} chown -R `whoami`:`whoami` cache/stages_bootstrap
+			fi
 		fi
-	fi
+	done
 
 	# Creating stage file
 	Create_stagefile .stage/bootstrap

Modified: dists/trunk/live-helper/helpers/lh_bootstrap_debootstrap
===================================================================
--- dists/trunk/live-helper/helpers/lh_bootstrap_debootstrap	2007-04-26 09:26:57 UTC (rev 1178)
+++ dists/trunk/live-helper/helpers/lh_bootstrap_debootstrap	2007-04-26 09:49:03 UTC (rev 1179)
@@ -74,12 +74,12 @@
 
 if [ -x "/usr/sbin/debootstrap" ]
 then
-	if [ "${LH_CACHE}" = "enabled" ]
-	then
-		# Restore old cache
-		if [ -d cache/chroot_bootstrap ]
+	for STAGE in ${LIVE_CACHE_STAGES}
+	do
+		if [ "${STAGE}" = "bootstrap" ] && [ -d cache/stages_bootstrap ]
 		then
-			${LH_ROOT_COMMAND} cp -a cache/chroot_bootstrap/* chroot
+			# Restore old cache
+			${LH_ROOT_COMMAND} cp -a cache/stages_bootstrap/* chroot
 
 			if [ -n "${LH_ROOT_COMMAND}" ]
 			then
@@ -91,11 +91,14 @@
 
 			exit 0
 		fi
+	done
 
-		if [ -d cache/bootstrap ]
+	if [ "${LH_CACHE_PACKAGES}" = "enabled" ]
+	then
+		if [ -d cache/packages_bootstrap ]
 		then
 			mkdir -p chroot/var/cache/apt/archives
-			cp cache/bootstrap/*.deb chroot/var/cache/apt/archives
+			cp cache/packages_bootstrap/*.deb chroot/var/cache/apt/archives
 		fi
 
 		# Executing debootstrap (download-only)
@@ -107,18 +110,18 @@
 		fi
 
 		# Removing old cache
-		if [ -d cache/bootstrap ]
+		if [ -d cache/packages_bootstrap ]
 		then
-			rm -f cache/bootstrap/*.deb
+			rm -f cache/packages_bootstrap/*.deb
 		fi
 
 		# Saving new cache
-		if [ ! -d cache/bootstrap ]
+		if [ ! -d cache/packages_bootstrap ]
 		then
-			mkdir -p cache/bootstrap
+			mkdir -p cache/packages_bootstrap
 		fi
 
-		cp chroot/var/cache/apt/archives/*.deb cache/bootstrap
+		cp chroot/var/cache/apt/archives/*.deb cache/packages_bootstrap
 	fi
 
 	# Executing debootstrap (regular run)
@@ -130,23 +133,26 @@
 	fi
 
 	# Removing bootstrap cache
-	rm -rf chroot/var/cache/apt/archives/*.deb
+	rm -f chroot/var/cache/apt/archives/*.deb
 
 	# Saving new cache
-	if [ "${LH_CACHE}" = "enabled" ]
-	then
-		if [ -d cache/chroot_bootstrap ]
+	for STAGE in ${LIVE_CACHE_STAGES}
+	do
+		if [ "${STAGE}" = "bootstrap" ]
 		then
-			rm -rf cache/chroot_bootstrap
-		fi
+			if [ -d cache/stages_bootstrap ]
+			then
+				rm -rf cache/stages_bootstrap
+			fi
 
-		${LH_ROOT_COMMAND} cp -a chroot cache/chroot_bootstrap
+			${LH_ROOT_COMMAND} cp -a chroot cache/stages_bootstrap
 
-		if [ -n "${LH_ROOT_COMMAND}" ]
-		then
-			${LH_ROOT_COMMAND} chown -R `whoami`:`whoami` cache/chroot_bootstrap
+			if [ -n "${LH_ROOT_COMMAND}" ]
+			then
+				${LH_ROOT_COMMAND} chown -R `whoami`:`whoami` cache/stages_bootstrap
+			fi
 		fi
-	fi
+	done
 
 	# Creating stage file
 	Create_stagefile .stage/bootstrap

Modified: dists/trunk/live-helper/helpers/lh_config
===================================================================
--- dists/trunk/live-helper/helpers/lh_config	2007-04-26 09:26:57 UTC (rev 1178)
+++ dists/trunk/live-helper/helpers/lh_config	2007-04-26 09:49:03 UTC (rev 1179)
@@ -97,10 +97,18 @@
 # (Default: ${LH_BOOTSTRAP})
 LH_BOOTSTRAP="${LH_BOOTSTRAP}"
 
-# \$LH_CACHE: control if downloaded packages should be cached
-# (Default: ${LH_CACHE})
-LH_CACHE="${LH_CACHE}"
+# \$LH_CACHE_INDICES: control if downloaded packages should be cached
+# (Default: ${LH_CACHE_INDICES})
+LH_CACHE_INDICES="${LH_CACHE_INDICES}"
 
+# \$LH_CACHE_PACKAGES: control if downloaded packages should be cached
+# (Default: ${LH_CACHE_PACKAGES})
+LH_CACHE_PACKAGES="${LH_CACHE_PACKAGES}"
+
+# \$LH_CACHE_STAGES: control if downloaded packages should be cached
+# (Default: ${LH_CACHE_STAGES})
+LH_CACHE_STAGES="${LH_CACHE_STAGES}"
+
 # \$LH_DEBCONF_FRONTEND: set the debconf(1) frontend to use
 # (Default: ${LH_DEBCONF_FRONTEND})
 LH_DEBCONF_FRONTEND="${LH_DEBCONF_FRONTEND}"




More information about the Debian-live-changes mailing list