Adjusting Save_cache(); to skip already cached .deb files and only copying new packages to it.

This commit is contained in:
Daniel Baumann 2008-04-19 17:39:44 +02:00
parent ac27ecc2e0
commit 7be45011f7
1 changed files with 9 additions and 8 deletions

View File

@ -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)" ]
for PACKAGE in chroot/var/cache/apt/archives/*.deb
do
if [ -e "${DIRECTORY}"/"$(basename ${PACKAGE})" ]
then
# with hardlinks
cp -fl chroot/var/cache/apt/archives/*.deb "${DIRECTORY}"
rm -f "${PACKAGE}"
else
# without hardlinks
mv -f chroot/var/cache/apt/archives/*.deb "${DIRECTORY}"
mv "${PACKAGE}" "${DIRECTORY}"
fi
done
fi
else
# Purging current cache