summaryrefslogtreecommitdiff
path: root/helpers/lh_binary_debian-installer
diff options
context:
space:
mode:
authorChris Lamb <chris@chris-lamb.co.uk>2008-07-26 00:27:29 +0100
committerDaniel Baumann <daniel@debian.org>2011-03-09 19:03:37 +0100
commitb9c6f0a083a0130e9aa829c8f5b418a74e2b2144 (patch)
tree620db8baff53ecf42888eb2b9d8d5b6e645418f0 /helpers/lh_binary_debian-installer
parent1b37572080c01cdaf6e66a1bc53ca029253e4803 (diff)
downloadvyos-live-build-b9c6f0a083a0130e9aa829c8f5b418a74e2b2144.tar.gz
vyos-live-build-b9c6f0a083a0130e9aa829c8f5b418a74e2b2144.zip
Fix cache poisoning issue in lh_binary_debian-installer with 404 downloads
When wget 404's, an target file is created - this poisons the cache as the file is apparently downloaded but in actuality is simply empty. We fix this by unconditionally deleting the cache file if wget fails and emitting an error.
Diffstat (limited to 'helpers/lh_binary_debian-installer')
-rwxr-xr-xhelpers/lh_binary_debian-installer8
1 files changed, 7 insertions, 1 deletions
diff --git a/helpers/lh_binary_debian-installer b/helpers/lh_binary_debian-installer
index 42412b012..b147b1225 100755
--- a/helpers/lh_binary_debian-installer
+++ b/helpers/lh_binary_debian-installer
@@ -207,7 +207,13 @@ Download_file () {
if [ ! -f "${_LH_CACHE_FILE}" ]
then
mkdir -p ${_LH_CACHE_DIR}
- wget ${WGET_OPTIONS} -O "${_LH_CACHE_FILE}" "${_LH_URL}"
+ if ! wget ${WGET_OPTIONS} -O "${_LH_CACHE_FILE}" "${_LH_URL}"
+ then
+ rm -f "${_LH_CACHE_FILE}"
+
+ Echo_error "Could not download file: ${_LH_URL}"
+ exit 1
+ fi
fi
cp -fl "${_LH_CACHE_FILE}" "${_LH_TARGET}"