diff options
author | Chris Lamb <chris@chris-lamb.co.uk> | 2008-07-24 05:48:47 +0100 |
---|---|---|
committer | Daniel Baumann <daniel@debian.org> | 2011-03-09 19:03:37 +0100 |
commit | 2a2668aef9183e06018ae5cc0172ae434fbd02ba (patch) | |
tree | 9c94bd4317eaf55c495a68ab0e1720e459e93292 /helpers | |
parent | 877603ae022b5ffa013df24066888bd9f0753799 (diff) | |
download | live-build-2a2668aef9183e06018ae5cc0172ae434fbd02ba.zip live-build-2a2668aef9183e06018ae5cc0172ae434fbd02ba.tar.gz |
Cache d-i kernel, initrd and mini.iso downloads (Closes: #492085)
Diffstat (limited to 'helpers')
-rwxr-xr-x | helpers/lh_binary_debian-installer | 14 |
1 files changed, 13 insertions, 1 deletions
diff --git a/helpers/lh_binary_debian-installer b/helpers/lh_binary_debian-installer index 85d88e3..d285f33 100755 --- a/helpers/lh_binary_debian-installer +++ b/helpers/lh_binary_debian-installer @@ -191,6 +191,10 @@ Install_file() { cp "${FILE}" "${TARGET}"/"${LETTER}"/"${SOURCE}" } +# Set absolute directory for caching; we require it when we call Download_file +# from a non-standard cwd. +_LH_CACHE_DIR="$(pwd)/cache/binary_debian-installer" + Download_file () { local _LH_TARGET _LH_TARGET="${1}" @@ -198,7 +202,15 @@ Download_file () { local _LH_URL _LH_URL="${2}" - wget ${WGET_OPTIONS} -O "${_LH_TARGET}" "${_LH_URL}" + _LH_CACHE_FILE="${_LH_CACHE_DIR}/$(echo "${_LH_URL}" | sed 's|/|_|g')" + + if [ ! -f "${_LH_CACHE_FILE}" ] + then + mkdir -p ${_LH_CACHE_DIR} + wget ${WGET_OPTIONS} -O "${_LH_CACHE_FILE}" "${_LH_URL}" + fi + + cp -fl "${_LH_CACHE_FILE}" "${_LH_TARGET}" } VMLINUZ_DI="vmlinuz" |