diff options
author | Daniel Baumann <daniel@debian.org> | 2008-04-15 17:16:28 +0200 |
---|---|---|
committer | Daniel Baumann <daniel@debian.org> | 2008-04-15 17:16:28 +0200 |
commit | fd818bdd1d1d2fb5423c5491966ee2e731ca3326 (patch) | |
tree | 165008fb0519eb887017d523ae9d742394a62808 /functions | |
parent | 214ad680d375f51341adce56dfa004b56e8e8dfb (diff) | |
download | vyos-live-build-fd818bdd1d1d2fb5423c5491966ee2e731ca3326.tar.gz vyos-live-build-fd818bdd1d1d2fb5423c5491966ee2e731ca3326.zip |
Improving .deb caching by using hardlinks (if possible).
Diffstat (limited to 'functions')
-rwxr-xr-x | functions/cache.sh | 18 |
1 files changed, 16 insertions, 2 deletions
diff --git a/functions/cache.sh b/functions/cache.sh index 06ec5a28b..1b043681d 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 |