Improving .deb caching by using hardlinks (if possible).
This commit is contained in:
parent
214ad680d3
commit
fd818bdd1d
|
@ -18,7 +18,14 @@ Restore_cache ()
|
||||||
if [ -d "${DIRECTORY}" ]
|
if [ -d "${DIRECTORY}" ]
|
||||||
then
|
then
|
||||||
# Restore old cache
|
# 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
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
@ -38,7 +45,14 @@ Save_cache ()
|
||||||
mkdir -p "${DIRECTORY}"
|
mkdir -p "${DIRECTORY}"
|
||||||
|
|
||||||
# Saving new cache
|
# 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
|
fi
|
||||||
else
|
else
|
||||||
# Purging current cache
|
# Purging current cache
|
||||||
|
|
Loading…
Reference in New Issue