From: Dwight Engen Date: Tue, 14 Jan 2014 01:04:56 +0000 (-0500) Subject: download: don't download signatures when --no-validate given X-Git-Tag: lxc-1.0.0.beta2~47 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=fad967669817061cda3aafc40be04dcb712a4767;p=thirdparty%2Flxc.git download: don't download signatures when --no-validate given - show full path to failed download location - change test to -f in case meta.tar.xz:templates has a blank line it won't attempt to sed a directory Signed-off-by: Dwight Engen Acked-by: Stéphane Graber --- diff --git a/templates/lxc-download.in b/templates/lxc-download.in index cab6cbcbe..fa54686ef 100644 --- a/templates/lxc-download.in +++ b/templates/lxc-download.in @@ -60,7 +60,7 @@ download_file() { if [ "$3" = "noexit" ]; then return 1 else - echo "ERROR: Failed to download $1" 1>&2 + echo "ERROR: Failed to download http://${DOWNLOAD_SERVER}/$1" 1>&2 exit 1 fi elif [ "$DOWNLOAD_SHOW_HTTP_WARNING" = "true" ]; then @@ -72,6 +72,14 @@ download_file() { fi } +download_sig() { + download_file $1 $2 noexit + if [ "$DOWNLOAD_VALIDATE" = "true" ]; then + echo "ERROR: Failed to download http://${DOWNLOAD_SERVER}/$1" 1>&2 + exit 1 + fi +} + gpg_setup() { if [ "$DOWNLOAD_VALIDATE" = "false" ]; then return @@ -263,8 +271,8 @@ if [ "$DOWNLOAD_USE_CACHE" = "false" ]; then ! download_file ${DOWNLOAD_INDEX_PATH}.${DOWNLOAD_COMPAT_LEVEL}.asc \ ${DOWNLOAD_TEMP}/index.asc noexit; then download_file ${DOWNLOAD_INDEX_PATH} ${DOWNLOAD_TEMP}/index normal - download_file ${DOWNLOAD_INDEX_PATH}.asc \ - ${DOWNLOAD_TEMP}/index.asc normal + download_sig ${DOWNLOAD_INDEX_PATH}.asc \ + ${DOWNLOAD_TEMP}/index.asc fi gpg_validate ${DOWNLOAD_TEMP}/index.asc @@ -298,14 +306,14 @@ if [ "$DOWNLOAD_USE_CACHE" = "false" ]; then echo "Downloading the rootfs" download_file $DOWNLOAD_URL/rootfs.tar.xz \ ${DOWNLOAD_TEMP}/rootfs.tar.xz normal - download_file $DOWNLOAD_URL/rootfs.tar.xz.asc \ + download_sig $DOWNLOAD_URL/rootfs.tar.xz.asc \ ${DOWNLOAD_TEMP}/rootfs.tar.xz.asc normal gpg_validate ${DOWNLOAD_TEMP}/rootfs.tar.xz.asc echo "Downloading the metadata" download_file $DOWNLOAD_URL/meta.tar.xz \ ${DOWNLOAD_TEMP}/meta.tar.xz normal - download_file $DOWNLOAD_URL/meta.tar.xz.asc \ + download_sig $DOWNLOAD_URL/meta.tar.xz.asc \ ${DOWNLOAD_TEMP}/meta.tar.xz.asc normal gpg_validate ${DOWNLOAD_TEMP}/meta.tar.xz.asc @@ -393,7 +401,7 @@ fi # Replace variables in all templates for file in $TEMPLATE_FILES; do - [ ! -e "$file" ] && continue + [ ! -f "$file" ] && continue sed -i "s#LXC_NAME#$LXC_NAME#g" $file sed -i "s#LXC_PATH#$LXC_PATH#g" $file