[SCM] debian-live/live-helper branch, master, updated. 1.0_a43-1-7-gfd818bd

Daniel Baumann daniel at debian.org
Tue Apr 15 15:16:34 UTC 2008


The following commit has been merged in the master branch:
commit fd818bdd1d1d2fb5423c5491966ee2e731ca3326
Author: Daniel Baumann <daniel at debian.org>
Date:   Tue Apr 15 17:16:28 2008 +0200

    Improving .deb caching by using hardlinks (if possible).

diff --git a/functions/cache.sh b/functions/cache.sh
index 06ec5a2..1b04368 100755
--- a/functions/cache.sh
+++ b/functions/cache.sh
@@ -18,7 +18,14 @@ Restore_cache ()
 		if [ -d "${DIRECTORY}" ]
 		then
 			# Restore old cache
-			cp "${DIRECTORY}"/*.deb chroot/var/cache/apt/archives
+			if [ "$(stat --printf %d ${DIRECTORY})" = "$(stat --printf %d chroot/var/cache/apt/archives)" ]
+			then
+				# with hardlinks
+				cp -fl "${DIRECTORY}"/*.deb chroot/var/cache/apt/archives
+			else
+				# without hardlinks
+				cp "${DIRECTORY}"/*.deb chroot/var/cache/apt/archives
+			fi
 		fi
 	fi
 }
@@ -38,7 +45,14 @@ Save_cache ()
 			mkdir -p "${DIRECTORY}"
 
 			# Saving new cache
-			mv -f chroot/var/cache/apt/archives/*.deb "${DIRECTORY}"
+			if [ "$(stat --printf %d ${DIRECTORY})" = "$(stat --printf %d chroot/var/cache/apt/archives)" ]
+			then
+				# with hardlinks
+				cp --force -l chroot/var/cache/apt/archives/*.deb "${DIRECTORY}"
+			else
+				# without hardlinks
+				mv -f chroot/var/cache/apt/archives/*.deb "${DIRECTORY}"
+			fi
 		fi
 	else
 		# Purging current cache

-- 
debian-live/live-helper



More information about the debian-live-changes mailing list