From 7be45011f768a2305ea1616ad22701fda339db67 Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Sat, 19 Apr 2008 17:39:44 +0200 Subject: Adjusting Save_cache(); to skip already cached .deb files and only copying new packages to it. --- functions/cache.sh | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/functions/cache.sh b/functions/cache.sh index 5493471..9e70f2c 100755 --- a/functions/cache.sh +++ b/functions/cache.sh @@ -45,14 +45,15 @@ Save_cache () mkdir -p "${DIRECTORY}" # Saving new cache - if [ "$(stat --printf %d ${DIRECTORY})" = "$(stat --printf %d chroot/var/cache/apt/archives)" ] - then - # with hardlinks - cp -fl chroot/var/cache/apt/archives/*.deb "${DIRECTORY}" - else - # without hardlinks - mv -f chroot/var/cache/apt/archives/*.deb "${DIRECTORY}" - fi + for PACKAGE in chroot/var/cache/apt/archives/*.deb + do + if [ -e "${DIRECTORY}"/"$(basename ${PACKAGE})" ] + then + rm -f "${PACKAGE}" + else + mv "${PACKAGE}" "${DIRECTORY}" + fi + done fi else # Purging current cache -- cgit v1.0